Parse and create URIs according to RFC3986.
More...
#include <uri.h>
Parse and create URIs according to RFC3986.
This class will parse and make the elements of the URI available as members.
Links:
◆ URI() [1/2]
mysqlrouter::URI::URI |
( |
const std::string & |
uri, |
|
|
bool |
allow_path_rootless = true , |
|
|
bool |
allow_schemeless = false , |
|
|
bool |
path_keep_last_slash = false , |
|
|
bool |
query_single_parameter_when_cant_parse = false |
|
) |
| |
|
inline |
Default constructor.
Rootless URIs like "mailto:user@example.com" may be forbidden to make sure that simple "host:addr" doesn't get parsed as (scheme='host', path='addr')
- Parameters
-
uri | URI string to decode |
allow_path_rootless | if parsing rootless URIs is allowed |
allow_schemeless | define if schema is mandatory |
path_keep_last_slash | parsing the URL keeps last slash |
query_single_parameter_when_cant_parse | This parameter allows to handles query parameter that follows the RFC but is not accepted by default implementation of URL |
◆ URI() [2/2]
mysqlrouter::URI::URI |
( |
| ) |
|
|
inline |
◆ get_path_as_string()
std::string mysqlrouter::URI::get_path_as_string |
( |
bool |
needs_first_slash = true | ) |
const |
Path part of the URI as string.
◆ get_query_as_string()
std::string mysqlrouter::URI::get_query_as_string |
( |
| ) |
const |
◆ init_from_uri()
void mysqlrouter::URI::init_from_uri |
( |
const std::string & |
uri | ) |
|
|
private |
Sets information using the given URI.
Takes a and parsers out all URI elements.
Throws URIError on errors.
- Parameters
-
◆ operator!=()
◆ operator==()
bool mysqlrouter::URI::operator== |
( |
const URI & |
u2 | ) |
const |
◆ set_path_from_string()
void mysqlrouter::URI::set_path_from_string |
( |
const std::string & |
p | ) |
|
Set the path part of the URI as string.
- Parameters
-
p | path string to decode and store in URI object |
◆ set_query_from_string()
void mysqlrouter::URI::set_query_from_string |
( |
const std::string & |
q | ) |
|
Set the URI query part by reparsing query string.
- Parameters
-
q | query string to decode and store in URI object |
◆ set_uri()
void mysqlrouter::URI::set_uri |
( |
const std::string & |
uri | ) |
|
|
inline |
Sets URI using the given URI string.
- Parameters
-
◆ str()
std::string mysqlrouter::URI::str |
( |
| ) |
const |
return string representation of the URI
◆ operator<<
◆ allow_path_rootless_
bool mysqlrouter::URI::allow_path_rootless_ |
|
private |
◆ allow_schemeless_
bool mysqlrouter::URI::allow_schemeless_ |
|
private |
◆ fragment
std::string mysqlrouter::URI::fragment |
Fragment part of the URI.
◆ host
std::string mysqlrouter::URI::host |
Host part found in the Authority.
◆ password
std::string mysqlrouter::URI::password |
Password part found in the Authority.
◆ path
◆ path_keep_last_slash_
bool mysqlrouter::URI::path_keep_last_slash_ |
|
private |
◆ port
uint16_t mysqlrouter::URI::port |
Port found in the Authority.
◆ query
◆ query_delimiter
const char mysqlrouter::URI::query_delimiter = '&' |
|
static |
Delimiter used in the Query part.
◆ query_is_signle_parameter_
bool mysqlrouter::URI::query_is_signle_parameter_ {false} |
|
private |
◆ query_single_parameter_when_cant_parse_
bool mysqlrouter::URI::query_single_parameter_when_cant_parse_ |
|
private |
◆ scheme
std::string mysqlrouter::URI::scheme |
◆ uri_
std::string mysqlrouter::URI::uri_ |
|
private |
Copy of the original given URI.
◆ username
std::string mysqlrouter::URI::username |
Username part found in the Authority.
The documentation for this class was generated from the following files:
- router/src/router/include/mysqlrouter/uri.h
- router/src/router/src/uri.cc