dot-xx
A personal collection of small C++ modules
|
HTTP request structure. Also used for multipart request data. More...
Public Types | |
using | HeaderMap |
Public Member Functions | |
Request (const Request &)=delete | |
Request & | operator= (const Request &)=delete |
Request (Request &&)=default | |
Request & | operator= (Request &&)=default |
HeaderError | parse_header (bool skip_method=false) |
Parse the header and fill the corresponding string views after we are sure that the header data will not be re-allocated. | |
std::expected< std::vector< Request >, MultipartError > | parse_multipart () const |
Parse the multipart content if the request is multipart. |
Public Attributes | |
std::string | header |
Full data of the request header, as recieved from the network. | |
std::string_view | method_string |
Method string (e.g. "GET", "POST" etc.) | |
Method | method |
Method tag if parsed successfully. | |
std::string_view | url |
Full requested resource URL (path + parameters) | |
std::string | resource |
The decoded path part of the resource URL. | |
std::string_view | params_string |
The params part of the resource URL (not decoded) | |
std::string_view | protocol |
Protocol version string, e.g. "HTTP/1.1" | |
HeaderMap | headers |
Header strings e.g. [ "Content-Type: text/plain", "Content-Length: 22" ] | |
std::flat_map< std::string, std::string > | params |
params_string parsed into a params map and decoded | |
std::vector< std::string > | substs |
URL substitutions during URL matching done by the server. | |
std::string | body |
The request body, as recieved from the network. |
HTTP request structure. Also used for multipart request data.
using dxx::http::Request::HeaderMap |
|
nodiscard |
Parse the header and fill the corresponding string views after we are sure that the header data will not be re-allocated.
skip_method | skip parsing the method string (e.g. "GET / HTTP/1.1") and jump right to the headers (used in multipart request parsing) |
Method dxx::http::Request::method |
Method tag if parsed successfully.
Uninitialized for multipart data
std::string_view dxx::http::Request::method_string |
Method string (e.g. "GET", "POST" etc.)
Empty for multipart data
std::flat_map<std::string, std::string> dxx::http::Request::params |
params_string parsed into a params map and decoded
Empty for multipart data
std::string_view dxx::http::Request::params_string |
The params part of the resource URL (not decoded)
Empty for multipart data
std::string_view dxx::http::Request::protocol |
Protocol version string, e.g. "HTTP/1.1"
Empty for multipart data
std::string dxx::http::Request::resource |
The decoded path part of the resource URL.
Empty for multipart data
std::vector<std::string> dxx::http::Request::substs |
URL substitutions during URL matching done by the server.
Empty for multipart data
std::string_view dxx::http::Request::url |
Full requested resource URL (path + parameters)
Empty for multipart data