|
| uri () |
| Creates an empty uri More...
|
|
_ASYNCRTIMP | uri (const utility::char_t *uri_string) |
| Creates a URI from the given encoded string. This will throw an exception if the string does not contain a valid URI. Use uri::validate if processing user-input. More...
|
|
_ASYNCRTIMP | uri (const utility::string_t &uri_string) |
| Creates a URI from the given encoded string. This will throw an exception if the string does not contain a valid URI. Use uri::validate if processing user-input. More...
|
|
| uri (const uri &other) |
| Copy constructor. More...
|
|
uri & | operator= (const uri &other) |
| Copy assignment operator. More...
|
|
| uri (uri &&other) CPPREST_NOEXCEPT |
| Move constructor. More...
|
|
uri & | operator= (uri &&other) CPPREST_NOEXCEPT |
| Move assignment operator More...
|
|
const utility::string_t & | scheme () const |
| Get the scheme component of the URI as an encoded string. More...
|
|
const utility::string_t & | user_info () const |
| Get the user information component of the URI as an encoded string. More...
|
|
const utility::string_t & | host () const |
| Get the host component of the URI as an encoded string. More...
|
|
int | port () const |
| Get the port component of the URI. Returns -1 if no port is specified. More...
|
|
const utility::string_t & | path () const |
| Get the path component of the URI as an encoded string. More...
|
|
const utility::string_t & | query () const |
| Get the query component of the URI as an encoded string. More...
|
|
const utility::string_t & | fragment () const |
| Get the fragment component of the URI as an encoded string. More...
|
|
_ASYNCRTIMP uri | authority () const |
| Creates a new uri object with the same authority portion as this one, omitting the resource and query portions. More...
|
|
_ASYNCRTIMP uri | resource () const |
| Gets the path, query, and fragment portion of this uri, which may be empty. More...
|
|
bool | is_empty () const |
| An empty URI specifies no components, and serves as a default value More...
|
|
bool | is_host_loopback () const |
| A loopback URI is one which refers to a hostname or ip address with meaning only on the local machine. More...
|
|
bool | is_host_wildcard () const |
| A wildcard URI is one which refers to all hostnames that resolve to the local machine (using the * or +) More...
|
|
bool | is_host_portable () const |
| A portable URI is one with a hostname that can be resolved globally (used from another machine). More...
|
|
bool | is_port_default () const |
|
bool | is_authority () const |
| An "authority" URI is one with only a scheme, optional userinfo, hostname, and (optional) port. More...
|
|
bool | has_same_authority (const uri &other) const |
| Returns whether the other URI has the same authority as this one More...
|
|
bool | is_path_empty () const |
| Returns whether the path portion of this URI is empty More...
|
|
utility::string_t | to_string () const |
| Returns the full (encoded) URI as a string. More...
|
|
_ASYNCRTIMP bool | operator== (const uri &other) const |
|
bool | operator< (const uri &other) const |
|
bool | operator!= (const uri &other) const |
|
|
static _ASYNCRTIMP utility::string_t __cdecl | encode_uri (const utility::string_t &raw, uri::components::component=components::full_uri) |
| Encodes a URI component according to RFC 3986. Note if a full URI is specified instead of an individual URI component all characters not in the unreserved set are escaped. More...
|
|
static _ASYNCRTIMP utility::string_t __cdecl | encode_data_string (const utility::string_t &utf8data) |
| Encodes a string by converting all characters except for RFC 3986 unreserved characters to their hexadecimal representation. More...
|
|
static _ASYNCRTIMP utility::string_t __cdecl | decode (const utility::string_t &encoded) |
| Decodes an encoded string. More...
|
|
static _ASYNCRTIMP std::vector< utility::string_t > __cdecl | split_path (const utility::string_t &path) |
| Splits a path into its hierarchical components. More...
|
|
static _ASYNCRTIMP std::map< utility::string_t, utility::string_t > __cdecl | split_query (const utility::string_t &query) |
| Splits a query into its key-value components. More...
|
|
static _ASYNCRTIMP bool __cdecl | validate (const utility::string_t &uri_string) |
| Validates a string as a URI. More...
|
|
A flexible, protocol independent URI implementation.
URI instances are immutable. Querying the various fields on an emtpy URI will return empty strings. Querying various diagnostic members on an empty URI will return false.
This implementation accepts both URIs ('http://msn.com/path') and URI relative-references ('/path?query::frag').
This implementation does not provide any scheme-specific handling – an example of this would be the following: 'http://path1/path'. This is a valid URI, but it's not a valid http-uri – that is, it's syntactically correct but does not conform to the requirements of the http scheme (http requires a host). We could provide this by allowing a pluggable 'scheme' policy-class, which would provide extra capability for validating and canonicalizing a URI according to scheme, and would introduce a layer of type-safety for URIs of differing schemes, and thus differing semantics.
One issue with implementing a scheme-independent URI facility is that of comparing for equality. For instance, these URIs are considered equal 'http://msn.com', 'http://msn.com:80'. That is – the 'default' port can be either omitted or explicit. Since we don't have a way to map a scheme to it's default port, we don't have a way to know these are equal. This is just one of a class of issues with regard to scheme-specific behavior.