#include <lluri.h>
Public Member Functions | |
std::string | asString () const |
the whole URI, escaped as needed | |
Static Public Member Functions | |
static LLURI | buildHTTP (const std::string &prefix, const LLSD &path, const LLSD &query) |
Escaping Utilities | |
static std::string | escape (const std::string &str, const std::string &allowed, bool is_allowed_sorted=false) |
Escape a string with a specified set of allowed characters. | |
static std::string | escape (const std::string &str) |
Escape a raw url with a reasonable set of allowed characters. | |
static std::string | unescape (const std::string &str) |
unescape an escaped URI string. | |
Parts of a URI | |
| |
std::string | authority () const |
BOOL | defaultPort () const |
const std::string & | escapedPath () const |
const std::string & | escapedQuery () const |
std::string | hostName () const |
U16 | hostPort () const |
std::string | opaque () const |
everything after the colon | |
std::string | password () const |
std::string | path () const |
LLSD | pathArray () const |
std::string | query () const |
LLSD | queryMap () const |
std::string | scheme () const |
ex.: "http", note lack of colon | |
std::string | userName () const |
static std::string | mapToQueryString (const LLSD &query_map) |
given a name value map, return a serialized query string. | |
static LLSD | queryMap (std::string escaped_query_string) |
LLURI instances are immutable See: http://www.ietf.org/rfc/rfc3986.txt
LLURI LLURI::buildHTTP | ( | const std::string & | prefix, | |
const LLSD & | path, | |||
const LLSD & | query | |||
) | [static] |
prefix is either a full URL prefix of the form "http://example.com:8080", or it can be simply a host and optional port like "example.com" or "example.com:8080", in these cases, the "http://" will be added
std::string LLURI::escape | ( | const std::string & | str, | |
const std::string & | allowed, | |||
bool | is_allowed_sorted = false | |||
) | [static] |
Escape a string with a specified set of allowed characters.
Escape a string by urlencoding all the characters that aren't in the allowed string.
str | The raw URI to escape. | |
allowed | Character array of allowed characters | |
is_allowed_sorted | Optimization hint if allowed array is sorted. |
std::string LLURI::escape | ( | const std::string & | str | ) | [static] |
Escape a raw url with a reasonable set of allowed characters.
The default set was chosen to match HTTP urls and general guidelines for naming resources. Passing in a raw url does not produce well defined results because you really need to know which segments are path parts because path parts are supposed to be escaped individually. The default set chosen is:
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz 0123456789 -._~ :@!$'()*+,=/?&#;
*NOTE: This API is basically broken because it does not allow you to specify significant path characters. For example, if the filename actually contained a /, then you cannot use this function to generate the serialized url for that resource.
str | The raw URI to escape. |
std::string LLURI::mapToQueryString | ( | const LLSD & | query_map | ) | [static] |
given a name value map, return a serialized query string.
query_map | a map of name value. every value must be representable as a string. |
std::string LLURI::unescape | ( | const std::string & | str | ) | [static] |
unescape an escaped URI string.
str | The escped URI to unescape. |