26#ifndef URI_ROUTING_INCLUDED
27#define URI_ROUTING_INCLUDED
47using URIQuery = std::map<std::string, std::string>;
55 URIError(
const char *msg,
const std::string &uri,
size_t position);
57 :
std::runtime_error(what_arg) {}
73 static const char query_delimiter =
'&';
88 URI(
const std::string &uri,
bool allow_path_rootless =
true,
89 bool allow_schemeless =
false,
bool path_keep_last_slash =
false,
90 bool query_single_parameter_when_cant_parse =
false)
100 allow_path_rootless_(allow_path_rootless),
101 allow_schemeless_{allow_schemeless},
102 path_keep_last_slash_{path_keep_last_slash},
103 query_single_parameter_when_cant_parse_{
104 query_single_parameter_when_cant_parse} {
114 std::string
str()
const;
123 void set_uri(
const std::string &uri) { init_from_uri(uri); }
126 std::string get_path_as_string(
bool needs_first_slash =
true)
const;
132 void set_path_from_string(
const std::string &
p);
135 std::string get_query_as_string()
const;
141 void set_query_from_string(
const std::string &
q);
171 void init_from_uri(
const std::string &uri);
183 bool query_is_signle_parameter_{
false};
191 static std::string
decode(
const std::string &uri,
bool decode_plus);
192 static URI parse(
const std::string &uri,
bool allow_path_rootless =
true,
193 bool allow_schemeless =
false,
194 bool path_keep_last_slash =
false,
195 bool query_single_parameter_when_cant_parse =
false);
196 static URI parse_shorthand_uri(
const std::string &uri,
197 bool allow_path_rootless =
true,
198 const std::string &default_scheme =
"mysql");
Exception when URI was not valid.
Definition: uri.h:53
URIError(const char *msg, const std::string &uri, size_t position)
Definition: uri.cc:62
URIError(const std::string &what_arg)
Definition: uri.h:56
Parse and create URIs according to RFC3986.
Definition: uri.h:70
bool query_single_parameter_when_cant_parse_
Definition: uri.h:182
std::string username
Username part found in the Authority.
Definition: uri.h:150
std::string scheme
Scheme of the URI.
Definition: uri.h:144
std::string password
Password part found in the Authority.
Definition: uri.h:152
bool allow_schemeless_
all URIs like foo@example.org which don't have a scheme
Definition: uri.h:180
void set_uri(const std::string &uri)
Sets URI using the given URI string.
Definition: uri.h:123
bool allow_path_rootless_
all URIs like mail:foo@example.org which don't have a authority
Definition: uri.h:177
std::string uri_
Copy of the original given URI.
Definition: uri.h:174
uint16_t port
Port found in the Authority.
Definition: uri.h:148
URIQuery query
Query part of the URI.
Definition: uri.h:156
URI()
overload
Definition: uri.h:117
std::string fragment
Fragment part of the URI.
Definition: uri.h:158
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)
Default constructor.
Definition: uri.h:88
bool path_keep_last_slash_
Definition: uri.h:181
URIPath path
Path part of the URI.
Definition: uri.h:154
std::string host
Host part found in the Authority.
Definition: uri.h:146
const char * p
Definition: ctype-mb.cc:1225
bool operator!=(const my_thread_handle &a, const my_thread_handle &b)
Definition: my_thread.h:158
bool operator==(const my_thread_handle &a, const my_thread_handle &b)
Definition: my_thread.h:151
static char * query
Definition: myisam_ftdump.cc:47
static char * password
Definition: mysql_secure_installation.cc:58
const char * host
Definition: mysqladmin.cc:65
static char * path
Definition: mysqldump.cc:149
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1105
stdx::expected< std::pair< size_t, T >, std::error_code > decode(const net::const_buffer &buffer, capabilities::value_type caps)
decode a message from a buffer.
Definition: classic_protocol_codec_base.h:119
std::vector< std::string > URIPath
Definition: uri.h:46
ROUTER_UTILS_EXPORT std::ostream & operator<<(std::ostream &strm, const URI &uri)
Definition: uri.cc:1205
std::tuple< std::string, uint16_t, std::string, std::string > URIAuthority
Definition: uri.h:45
std::map< std::string, std::string > URIQuery
Definition: uri.h:47
bool parse(MYSQL_THD thd, const string &query, bool is_prepared, Condition_handler *handler)
Definition: services.cc:81
Definition: gcs_xcom_synode.h:64
required uint64 port
Definition: replication_asynchronous_connection_failover.proto:33
#define ROUTER_UTILS_EXPORT
Definition: router_utils_export.h:15
synode_no q[FIFO_SIZE]
Definition: xcom_base.cc:4086