10Duke Enterprise C++ SDK
Loading...
Searching...
No Matches
tenduke::net Namespace Reference

Detailed Description

Generic networking support.

Services for generic networking support.

Namespaces

namespace  curl
 libcurl based implementation of generic network services.

Classes

class  AbstractURLCodec
 Base implementation of tenduke::net::URLCodec which provides base functionality and can be subclassed to provide specific implementations for the encoding / decoding of URL components. More...
class  AbstractURLParser
 Base class for URL parsing. More...
class  AbstractURLs
 Abstract base implementation of tenduke::net::URLs. More...
class  MalformedURLException
 Thrown when URL is malformed. More...
class  NetworkingException
 Generic networking exception. More...
class  RequestTimedOut
 A tenduke::net::NetworkingException thrown when network request timed out. More...
class  SimpleURLService
class  UnknownHostException
 A tenduke::net::NetworkingException thrown when the host is not found. More...
class  URL
 Represents URL. More...
class  URLBuilder
 Very simple URL-builder. More...
class  URLCodec
 URL-related coding / encoding functionality. More...
class  URLDecoder
 Service to URL-decode a string. More...
class  URLEncoder
 Service to URL-encode a string. More...
class  URLException
 A tenduke::net::NetworkingException thrown when various URL-related errors occur. More...
class  URLParser
 A service to parse URLs from strings. More...
class  URLs
 URL-related functionality. More...

Functions

std::string normalizeEncodedURLPath (const std::string &encodedPath)
 Normalizes an already encoded URL path so that it can be written to a URL as is, without changing its meaning.
void validateHostname (const std::string &hostname)
 Checks that hostname is a syntactically valid URL host, which can be written to a URL as is.

Function Documentation

◆ normalizeEncodedURLPath()

std::string tenduke::net::normalizeEncodedURLPath ( const std::string & encodedPath)

Normalizes an already encoded URL path so that it can be written to a URL as is, without changing its meaning.

Keeps (see https://www.rfc-editor.org/rfc/rfc3986#section-3.3):

  • unreserved characters, sub-delims, :, @ and /
  • percent-encoded octets (% followed by two hex digits), unchanged. E.g. %2F stays %2F and is not turned into a path separator.

Percent-encodes all other characters, e.g. whitespace, control characters, non-ASCII (UTF-8) bytes, ", <, >, ?, #, and % which does not start a percent-encoded octet.

For a valid encoded path the result is the path unchanged.

Parameters
encodedPaththe encoded path
Returns
the normalized path

◆ validateHostname()

void tenduke::net::validateHostname ( const std::string & hostname)

Checks that hostname is a syntactically valid URL host, which can be written to a URL as is.

Accepts (see https://www.rfc-editor.org/rfc/rfc3986#section-3.2.2):

  • reg-name: unreserved and sub-delims characters and percent-encoded octets. This includes IPv4 addresses. Non-ASCII (UTF-8) characters are accepted as well, to allow internationalized domain names.
  • IP-literal: the above characters and : in square brackets, e.g. [::1]
  • empty hostname

Rejects all other characters, e.g. quotes, whitespace, control characters, /, \\endiskip, @, ?, #, <, > and : outside of brackets.

Parameters
hostname-
Exceptions
tenduke::net::MalformedURLExceptionif the hostname is not valid