Class representing a URI.
Synopsis
Declared in <folly/Uri.h>
class Uri;
Description
Consider http://www.facebook.com/foo/bar?key=foo#anchor
The URI is broken down into its parts: scheme ("http"), authority (ie. host and port, in most cases: "www.facebook.com"), path ("/foo/bar"), query ("key=foo") and fragment ("anchor"). The scheme is lower‐cased.
If this Uri represents a URL, note that, to prevent ambiguity, the component parts are NOT percent‐decoded; you should do this yourself with uriUnescape() (for the authority and path) and uriUnescape(..., UriEscapeMode::QUERY) (for the query, but probably only after splitting at '&' to identify the individual parameters).
Member Functions
Name |
Description |
|
Parse a Uri from a string. Same as tryFromString except it throws a std::invalid_argument if there's an error. |
Return the authority component (user info, host and port) of the URI. |
|
Reassemble the URI into an fbstring. |
|
Return the fragment component of the URI. |
|
Get query parameters as key‐value pairs. e.g. for URI containing query string: key1=foo&key2=&key3&=bar&=bar= In returned list, there are 3 entries: "key1" => "foo" "key2" => "" "key3" => "" Parts "=bar" and "=bar=" are ignored, as they are not valid query parameters. "=bar" is missing parameter name, while "=bar=" has more than one equal signs, we don't know which one is the delimiter for key and value. |
|
Get host part of URI. If host is an IPv6 address, square brackets will be returned, for example: "[::1]". |
|
Get host part of URI. If host is an IPv6 address, square brackets will not be returned, for example "::1"; otherwise it returns the same thing as host(). |
|
Return the password component of the authority. |
|
Return the path component of the URI. |
|
Return the port component of the URI. |
|
Return the query component of the URI. |
|
Return the scheme component, lower‐cased. |
|
Set the port component and mark the URI as having an authority. |
|
Reassemble the URI into a std::string. |
|
Reassemble the URI into a string of the given string type. |
|
Return the username component of the authority. |
Static Member Functions
Name |
Description |
Parse a Uri from a string. |
Created with MrDocs