Kea: isc::http::Url Class Reference

| Kea 3.2.0-git

isc::http::Url Class Reference

Represents an URL. More...

`#include <url.h>`

## Public Types
enum | Scheme { HTTP , HTTPS }
| Scheme: https or http. More...

## Public Member Functions
| Url (const std::string &url)
| Constructor.
std::string | getErrorMessage () const
| Returns parsing error message.
std::string | getPath () const
| Returns path.
unsigned | getPort () const
| Returns port number.
Scheme | getScheme () const
| Returns parsed scheme.
std::string | getStrippedHostname () const
| Returns hostname stripped from [ ] characters surrounding IPv6 address.
bool | isValid () const
| Checks if the URL is valid.
bool | operator< (const Url &url) const
| compares URLs lexically.
const std::string & | rawUrl () const
| Returns the raw, unparsed URL string.
std::string | toText () const
| Returns textual representation of the URL.

## Detailed Description

Represents an URL.

It parses the provided URL and allows for retrieving the parts of it after parsing.

Definition at line 20 of file url.h.

## Member Enumeration Documentation

## ◆ Scheme

enum isc::http::Url::Scheme

Scheme: https or http.

Enumerator
HTTP |
HTTPS |

Definition at line 24 of file url.h.

## Constructor & Destructor Documentation

## ◆ Url()

isc::http::Url::Url | ( | const std::string & | url | ) |
| explicit

Constructor.

Parses provided URL.

Parameters

  url | URL.

Definition at line 19 of file url.cc.

References Url(), and HTTPS.

Referenced by Url(), and operator<().

Here is the call graph for this function:

## Member Function Documentation

## ◆ getErrorMessage()

std::string isc::http::Url::getErrorMessage | ( |  | ) | const
| inline

Returns parsing error message.

Definition at line 52 of file url.h.

Referenced by isc::netconf::ControlSocketConfigParser::parse().

## ◆ getPath()

std::string isc::http::Url::getPath | ( |  | ) | const

Returns path.

Returns
  URL path

Exceptions

  InvalidOperation | if URL is invalid.

Definition at line 59 of file url.cc.

Referenced by toText().

## ◆ getPort()

unsigned isc::http::Url::getPort | ( |  | ) | const

Returns port number.

Returns
  Port number or 0 if URL doesn't contain port number.

Exceptions

  InvalidOperation | if URL is invalid.

Definition at line 53 of file url.cc.

Referenced by toText().

## ◆ getScheme()

Url::Scheme isc::http::Url::getScheme | ( |  | ) | const

Returns parsed scheme.

Exceptions

  InvalidOperation | if URL is invalid.

Definition at line 31 of file url.cc.

Referenced by isc::http::HttpClient::asyncSendRequest(), and toText().

## ◆ getStrippedHostname()

std::string isc::http::Url::getStrippedHostname | ( |  | ) | const

Returns hostname stripped from [ ] characters surrounding IPv6 address.

Exceptions

  InvalidOperation | if URL is invalid.

Definition at line 43 of file url.cc.

## ◆ isValid()

bool isc::http::Url::isValid | ( |  | ) | const
| inline

Checks if the URL is valid.

Returns
  true if the URL is valid, false otherwise.

Definition at line 47 of file url.h.

Referenced by isc::http::HttpClient::asyncSendRequest(), and isc::netconf::ControlSocketConfigParser::parse().

## ◆ operator<()

bool isc::http::Url::operator< | ( | const Url & | url | ) | const

compares URLs lexically.

Both URLs are compared as text.

Parameters

  url | URL to be compared with

Returns
  true if the other operator is larger (in lexical sense)

Definition at line 25 of file url.cc.

References Url(), and rawUrl().

Here is the call graph for this function:

## ◆ rawUrl()

const std::string & isc::http::Url::rawUrl | ( |  | ) | const
| inline

Returns the raw, unparsed URL string.

Returns
  Unparsed URL string.

Definition at line 87 of file url.h.

Referenced by operator<().

## ◆ toText()

std::string isc::http::Url::toText | ( |  | ) | const

Returns textual representation of the URL.

Returns
  Text version of the URL.

Definition at line 65 of file url.cc.

References getPath(), getPort(), getScheme(), and HTTP.

Here is the call graph for this function:

The documentation for this class was generated from the following files:

- url.h
- url.cc