Orbit Framework 2.0.0
A high-performance asynchronous C++20 HTTP server framework.
Loading...
Searching...
No Matches
orbit::http::h2::detail Namespace Reference

Classes

struct  HeaderBlock
 Owns the header name/value strings backing an nghttp2_nv list. More...
 

Functions

HeaderBlock build_response_headers (const http::HttpResponse &response)
 Builds the HTTP/2 response header list for a response.
 
bool parse_method (std::string_view value, http::HttpMethod &out)
 Maps an HTTP/2 :method pseudo-header value to an HttpMethod.
 
bool is_connection_specific_header (std::string_view name)
 True if a header is forbidden in HTTP/2 and must not be forwarded.
 
bool apply_request_target (std::string_view target, http::HttpRequest &req)
 Fills req.uri (the decoded path), req.target and req.query from a request target such as an HTTP/2 or HTTP/3 :path, decoding it as the HTTP/1.1 parser does.
 
void parse_cookies (std::string_view cookies, http::HttpRequest &req)
 Adds the name=value pairs of a Cookie header value to req.cookies.
 

Function Documentation

◆ apply_request_target()

bool orbit::http::h2::detail::apply_request_target ( std::string_view  target,
http::HttpRequest &  req 
)

Fills req.uri (the decoded path), req.target and req.query from a request target such as an HTTP/2 or HTTP/3 :path, decoding it as the HTTP/1.1 parser does.

Returns
False if the target is malformed (bad escape, or an encoded '/', '\' or NUL in the path); the request must be answered with 400.

◆ build_response_headers()

HeaderBlock orbit::http::h2::detail::build_response_headers ( const http::HttpResponse &  response)

Builds the HTTP/2 response header list for a response.

Emits the mandatory :status pseudo-header first, then each response header with its name lowercased as HTTP/2 requires. Connection-specific headers that are forbidden in HTTP/2 (RFC 9113 section 8.2.2) are dropped.

Parameters
responseThe response whose headers should be encoded.
Returns
A HeaderBlock owning the encoded names/values and the nv list.

◆ is_connection_specific_header()

bool orbit::http::h2::detail::is_connection_specific_header ( std::string_view  name)

True if a header is forbidden in HTTP/2 and must not be forwarded.

Parameters
nameThe header name, in any case.

◆ parse_cookies()

void orbit::http::h2::detail::parse_cookies ( std::string_view  cookies,
http::HttpRequest &  req 
)

Adds the name=value pairs of a Cookie header value to req.cookies.

◆ parse_method()

bool orbit::http::h2::detail::parse_method ( std::string_view  value,
http::HttpMethod &  out 
)

Maps an HTTP/2 :method pseudo-header value to an HttpMethod.

Parameters
valueThe :method value as received on the wire.
outSet to the parsed method on success; untouched on failure.
Returns
True if the method was recognised.