26#ifndef MYSQLROUTER_HTTP_REQUEST_INCLUDED
27#define MYSQLROUTER_HTTP_REQUEST_INCLUDED
37#include <system_error>
123 return "Switching Protocols";
127 return "Early Hints";
136 return "Non Authoritive Information";
140 return "Reset Content";
142 return "Partial Content";
144 return "Multi Status";
146 return "Already Reported";
151 return "Multiple Choices";
153 return "Moved Permanently";
159 return "Not Modified";
163 return "Temporary Redirect";
165 return "Permanent Redirect";
168 return "Bad Request";
170 return "Unauthorized";
172 return "Payment Required";
178 return "Method Not Allowed";
180 return "Not NotAcceptable";
182 return "Proxy Authentication Required";
184 return "Request Timeout";
190 return "Length Required";
192 return "Precondition Failed";
194 return "Payload Too Large";
196 return "URITooLarge";
198 return "Unsupported MediaType";
200 return "Range Not Satisfiable";
202 return "Expectation Failed";
204 return "I am a Teapot";
206 return "Misdirected Request";
208 return "Unprocessable Entity";
212 return "Failed Dependency";
214 return "Upgrade Required";
216 return "Precondition Required";
218 return "Too Many Requests";
220 return "Request Header Fields Too Large";
222 return "Unavailable For Legal Reasons";
225 return "Internal Error";
227 return "Not Implemented";
229 return "Bad Gateway";
231 return "Service Unavailable";
233 return "Gateway Timeout";
235 return "HTTP Version Not Supported";
237 return "Variant Also Negotiates";
239 return "Insufficient Storage";
241 return "Loop Detected";
243 return "Not Extended";
245 return "Network Authorization Required";
268using Bitset = std::bitset<Pos::_LAST + 1>;
291 bool is_valid()
const {
return handle_ !=
nullptr; }
307 std::pair<std::string, std::string> operator*();
321 int add(
const char *
key,
const char *value);
326 const char *
get(
const char *
key)
const;
359 void add(
const char *data,
size_t data_size);
364 void add_file(
int file_fd, off_t offset, off_t size);
374 std::vector<uint8_t> pop_front(
size_t length);
401 static std::string
decode(
const std::string &uri_str,
const bool decode_plus);
407 std::string
join()
const;
409 std::string get_scheme()
const;
410 void set_scheme(
const std::string &scheme);
412 std::string get_userinfo()
const;
413 void set_userinfo(
const std::string &userinfo);
415 std::string get_host()
const;
416 void set_host(
const std::string &
host);
418 uint16_t get_port()
const;
419 void set_port(uint16_t
port)
const;
424 std::string get_path()
const;
425 void set_path(
const std::string &
path);
427 std::string get_fragment()
const;
428 void set_fragment(
const std::string &fragment);
430 std::string get_query()
const;
431 void set_query(
const std::string &
query);
436 operator bool()
const;
441 HttpUri(std::unique_ptr<impl> &&uri);
466 unsigned get_response_code()
const;
467 std::string get_response_code_line()
const;
474 send_reply(status_code,
477 void send_reply(
int status_code, std::string status_text);
478 void send_reply(
int status_code, std::string status_text,
HttpBuffer &
buffer);
481 send_error(status_code,
484 void send_error(
int status_code, std::string status_text);
488 operator bool()
const;
491 void error_code(
int);
492 std::string error_msg();
494 std::error_code socket_error_code()
const;
495 void socket_error_code(std::error_code ec);
503 bool is_modified_since(time_t last_modified);
508 bool add_last_modified(time_t last_modified);
581 const std::string &uri_path);
598 size_t date_buf_len);
A simple bitset wrapper class, which lets you access an existing range of bytes (not owned by it!...
Definition: ut0bitset.h:54
Main event registration and dispatch engine
Definition: http_common.h:115
Enables bufforing of I/O for a socket.
Definition: http_common.h:200
Http bound socket.
Definition: http_request.h:286
BoundHandle handle_
Definition: http_request.h:294
void * BoundHandle
Definition: http_request.h:288
EventHttpBoundSocket(BoundHandle handle)
Definition: http_request.h:289
bool is_valid() const
Definition: http_request.h:291
Http server build on top of EventBase.
Definition: http_request.h:525
std::unique_ptr< impl > pImpl_
Definition: http_request.h:562
void(*)(HttpRequest *, void *) CallbackRequest
Definition: http_request.h:527
net::impl::socket::native_handle_type SocketHandle
Definition: http_request.h:529
EventBuffer(*)(EventBase *, void *) CallbackBuffer
Definition: http_request.h:528
a Buffer to send/read from network.
Definition: http_request.h:350
std::unique_ptr< impl > pImpl_
Definition: http_request.h:381
HttpBuffer(HttpBuffer &&)
Definition: http_client.h:65
a HTTP request and response.
Definition: http_request.h:453
void(*)(HttpRequest *, void *) RequestHandler
Definition: http_request.h:455
void send_error(int status_code)
Definition: http_request.h:480
std::unique_ptr< impl > pImpl_
Definition: http_request.h:515
void send_reply(int status_code)
Definition: http_request.h:473
representation of HTTP URI.
Definition: http_request.h:391
std::unique_ptr< impl > pImpl_
Definition: http_request.h:443
This class is used to trace function calls and other process information.
Definition: semisync.h:43
#define HTTP_COMMON_EXPORT
Definition: http_common_export.h:40
HTTP_COMMON_EXPORT std::string http_uri_path_canonicalize(const std::string &uri_path)
canonicalize a URI path.
Definition: http_common.cc:415
HTTP_COMMON_EXPORT time_t time_from_rfc5322_fixdate(const char *date_buf)
convert a Date: header into a time_t.
Definition: http_time.cc:76
HTTP_COMMON_EXPORT int time_to_rfc5322_fixdate(time_t ts, char *date_buf, size_t date_buf_len)
convert time_t into a Date: header value.
Definition: http_time.cc:37
static std::string to_string(const LEX_STRING &str)
Definition: lex_string.h:50
bool operator!=(const my_thread_handle &a, const my_thread_handle &b)
Definition: my_thread.h:158
static char * query
Definition: myisam_ftdump.cc:45
const char * host
Definition: mysqladmin.cc:59
static char * path
Definition: mysqldump.cc:137
constexpr pos_type Options
Definition: http_request.h:261
constexpr pos_type Connect
Definition: http_request.h:263
constexpr pos_type Patch
Definition: http_request.h:264
constexpr pos_type Head
Definition: http_request.h:258
constexpr pos_type Get
Definition: http_request.h:256
constexpr pos_type _LAST
Definition: http_request.h:266
constexpr pos_type Put
Definition: http_request.h:259
constexpr pos_type Delete
Definition: http_request.h:260
constexpr pos_type Post
Definition: http_request.h:257
constexpr pos_type Trace
Definition: http_request.h:262
Definition: http_request.h:252
constexpr type Get
Definition: http_request.h:270
std::bitset< Pos::_LAST+1 > Bitset
Definition: http_request.h:268
constexpr type Delete
Definition: http_request.h:274
int type
Definition: http_request.h:253
constexpr type Options
Definition: http_request.h:275
unsigned pos_type
Definition: http_request.h:254
constexpr type Patch
Definition: http_request.h:278
constexpr type Connect
Definition: http_request.h:277
constexpr type Post
Definition: http_request.h:271
constexpr type Head
Definition: http_request.h:272
constexpr type Put
Definition: http_request.h:273
Definition: http_request.h:48
constexpr key_type PermanentRedirect
Definition: http_request.h:75
constexpr key_type ResetContent
Definition: http_request.h:62
constexpr key_type Gone
Definition: http_request.h:87
constexpr key_type Processing
Definition: http_request.h:54
constexpr key_type VariantAlsoNegotiates
Definition: http_request.h:112
int key_type
Definition: http_request.h:50
constexpr key_type ExpectationFailed
Definition: http_request.h:94
constexpr key_type PreconditionFailed
Definition: http_request.h:89
constexpr key_type RequestHeaderFieldsTooLarge
Definition: http_request.h:103
constexpr key_type InternalError
Definition: http_request.h:106
constexpr key_type UnsupportedMediaType
Definition: http_request.h:92
constexpr key_type MethodNotAllowed
Definition: http_request.h:82
constexpr key_type EarlyHints
Definition: http_request.h:55
constexpr key_type Continue
Definition: http_request.h:52
constexpr key_type MovedPermanently
Definition: http_request.h:69
constexpr key_type HTTPVersionNotSupported
Definition: http_request.h:111
constexpr key_type InstanceManipulationUsed
Definition: http_request.h:66
constexpr key_type NotExtended
Definition: http_request.h:115
constexpr key_type Accepted
Definition: http_request.h:59
constexpr key_type FailedDependency
Definition: http_request.h:99
constexpr key_type RequestTimeout
Definition: http_request.h:85
constexpr key_type MisdirectedRequest
Definition: http_request.h:96
constexpr key_type NoContent
Definition: http_request.h:61
constexpr key_type BadRequest
Definition: http_request.h:77
constexpr key_type LengthRequired
Definition: http_request.h:88
constexpr key_type UpgradeRequired
Definition: http_request.h:100
constexpr key_type GatewayTimeout
Definition: http_request.h:110
constexpr key_type SeeOther
Definition: http_request.h:71
constexpr key_type UnavailableForLegalReasons
Definition: http_request.h:104
constexpr key_type PartialContent
Definition: http_request.h:63
constexpr key_type Forbidden
Definition: http_request.h:80
constexpr key_type IamaTeapot
Definition: http_request.h:95
constexpr key_type MultipleChoices
Definition: http_request.h:68
constexpr key_type BadGateway
Definition: http_request.h:108
constexpr key_type NetworkAuthorizationRequired
Definition: http_request.h:116
constexpr key_type Created
Definition: http_request.h:58
constexpr key_type NotAcceptable
Definition: http_request.h:83
constexpr key_type Conflicts
Definition: http_request.h:86
constexpr key_type NotImplemented
Definition: http_request.h:107
constexpr key_type Found
Definition: http_request.h:70
constexpr key_type SwitchingProtocols
Definition: http_request.h:53
constexpr key_type UnprocessableEntity
Definition: http_request.h:97
name_type get_default_status_text(key_type key)
Definition: http_request.h:118
constexpr key_type Ok
Definition: http_request.h:57
constexpr key_type Locked
Definition: http_request.h:98
constexpr key_type RangeNotSatisfiable
Definition: http_request.h:93
constexpr key_type Unauthorized
Definition: http_request.h:78
constexpr key_type InsufficientStorage
Definition: http_request.h:113
constexpr key_type MultiStatus
Definition: http_request.h:64
constexpr key_type ProxyAuthenticationRequired
Definition: http_request.h:84
constexpr key_type PreconditionRequired
Definition: http_request.h:101
constexpr key_type TooManyRequests
Definition: http_request.h:102
const char * name_type
Definition: http_request.h:49
constexpr key_type ServiceUnavailable
Definition: http_request.h:109
constexpr key_type TemporaryRedirect
Definition: http_request.h:74
constexpr key_type PayloadTooLarge
Definition: http_request.h:90
constexpr key_type NotFound
Definition: http_request.h:81
constexpr key_type URITooLarge
Definition: http_request.h:91
constexpr key_type LoopDetected
Definition: http_request.h:114
constexpr key_type PaymentRequired
Definition: http_request.h:79
constexpr key_type NonAuthoritiveInformation
Definition: http_request.h:60
constexpr key_type UseProxy
Definition: http_request.h:73
constexpr key_type NotModified
Definition: http_request.h:72
constexpr key_type AlreadyReported
Definition: http_request.h:65
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
bool length(const dd::Spatial_reference_system *srs, const Geometry *g1, double *length, bool *null) noexcept
Computes the length of linestrings and multilinestrings.
Definition: length.cc:76
Definition: authentication.cc:36
std::string join(Container cont, const std::string &delim)
join elements of an container into a string separated by a delimiter.
Definition: string.h:151
int native_handle_type
Definition: socket_constants.h:51
mutable_buffer buffer(void *p, size_t n) noexcept
Definition: buffer.h:420
void get(PSI_field *, PSI_longlong *) noexcept
Definition: pfs_plugin_column_bigint_v1_all_empty.cc:32
static mysql_service_status_t add(reference_caching_channel channel, const char *implementation_name) noexcept
Definition: component.cc:135
Cursor end()
A past-the-end Cursor.
Definition: rules_table_service.cc:192
static int handle(int sql_errno, const char *sqlstate, const char *message, void *state)
Bridge function between the C++ API offered by this module and the C API of the parser service.
Definition: services.cc:64
bool parse(MYSQL_THD thd, const string &query, bool is_prepared, Condition_handler *handler)
Definition: services.cc:81
required string key
Definition: replication_asynchronous_connection_failover.proto:60
required uint64 port
Definition: replication_asynchronous_connection_failover.proto:33
Ssl_acceptor_context_property_type & operator++(Ssl_acceptor_context_property_type &property_type)
Increment operator for Ssl_acceptor_context_type Used by iterator.
Definition: ssl_acceptor_context_data.cc:114