Kea: isc::http::Url Class Reference

| Kea 1.5.0

Public Types | Public Member Functions | List of all members
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 | getHostname () const
| Returns hostname.
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.
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.

## 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().

## ◆ getHostname()

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

Returns hostname.

Exceptions

  InvalidOperation | if URL is invalid.

Definition at line 37 of file url.cc.

Referenced by getStrippedHostname(), and toText().

## ◆ getPath()

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

Returns 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 toText().

## ◆ getStrippedHostname()

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

Returns hostname stripped from [ ] characters surrounding IPv6 address.

Exceptions

  InvalidOperation | of URL is invalid.

Definition at line 43 of file url.cc.

References getHostname().

Here is the call graph for this function:

## ◆ 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 toText().

Here is the call graph for this function:

## ◆ toText()

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

Returns textual representation of the URL.

Definition at line 65 of file url.cc.

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

Referenced by operator<(), and isc::netconf::CfgControlSocket::toElement().

Here is the call graph for this function:

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

- url.h
- url.cc