dot-xx
A personal collection of small C++ modules
Loading...
Searching...
No Matches
dxx::http::Request Struct Referenceexport
module dxx.http

HTTP request structure. Also used for multipart request data. More...

Public Types

using HeaderMap

Public Member Functions

 Request (const Request &)=delete
Requestoperator= (const Request &)=delete
 Request (Request &&)=default
Requestoperator= (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 >, MultipartErrorparse_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.

Detailed Description

HTTP request structure. Also used for multipart request data.

Member Typedef Documentation

◆ HeaderMap

using dxx::http::Request::HeaderMap
Initial value:
std::flat_map<
std::string_view, std::string_view, HeaderCompare
>
HTTP headers comparison struct - they must be case-insensitive.
Definition message.xx:17

Member Function Documentation

◆ parse_header()

HeaderError dxx::http::Request::parse_header ( bool skip_method = false)
nodiscard

Parse the header and fill the corresponding string views after we are sure that the header data will not be re-allocated.

Parameters
skip_methodskip parsing the method string (e.g. "GET / HTTP/1.1") and jump right to the headers (used in multipart request parsing)

Member Data Documentation

◆ method

Method dxx::http::Request::method

Method tag if parsed successfully.

Uninitialized for multipart data

◆ method_string

std::string_view dxx::http::Request::method_string

Method string (e.g. "GET", "POST" etc.)

Empty for multipart data

◆ params

std::flat_map<std::string, std::string> dxx::http::Request::params

params_string parsed into a params map and decoded

Empty for multipart data

◆ params_string

std::string_view dxx::http::Request::params_string

The params part of the resource URL (not decoded)

Empty for multipart data

◆ protocol

std::string_view dxx::http::Request::protocol

Protocol version string, e.g. "HTTP/1.1"

Empty for multipart data

◆ resource

std::string dxx::http::Request::resource

The decoded path part of the resource URL.

Empty for multipart data

◆ substs

std::vector<std::string> dxx::http::Request::substs

URL substitutions during URL matching done by the server.

Empty for multipart data

◆ url

std::string_view dxx::http::Request::url

Full requested resource URL (path + parameters)

Empty for multipart data


The documentation for this struct was generated from the following file:
  • /build-llvm-libcpp/_deps/dot-xx-http-src/src/message.xx