|
Network System 0.1.1
High-performance modular networking library for scalable client-server applications
|
HTTP/2 request data structure. More...
#include <http2_request.h>

Public Member Functions | |
| auto | get_header (std::string_view name) const -> std::optional< std::string > |
| Get header value by name (case-insensitive) | |
| auto | content_type () const -> std::optional< std::string > |
| Get Content-Type header value. | |
| auto | content_length () const -> std::optional< size_t > |
| Get Content-Length header value as size_t. | |
| auto | get_body_string () const -> std::string |
| Get request body as UTF-8 string. | |
| auto | is_valid () const -> bool |
| Check if this is a valid HTTP/2 request. | |
Static Public Member Functions | |
| static auto | from_headers (const std::vector< http_header > &parsed_headers) -> http2_request |
| Create http2_request from parsed headers. | |
Public Attributes | |
| std::string | method |
| HTTP method (:method pseudo-header) | |
| std::string | path |
| Request path (:path pseudo-header) | |
| std::string | authority |
| Authority (:authority pseudo-header) | |
| std::string | scheme |
| Scheme (:scheme pseudo-header) | |
| std::vector< http_header > | headers |
| Regular headers (non-pseudo) | |
| std::vector< uint8_t > | body |
| Request body from DATA frames. | |
HTTP/2 request data structure.
Represents an incoming HTTP/2 request with all pseudo-headers and regular headers parsed from HEADERS frames.
Definition at line 32 of file http2_request.h.
|
inlinenodiscard |
Get Content-Length header value as size_t.
Definition at line 79 of file http2_request.h.
|
inlinenodiscard |
Get Content-Type header value.
Definition at line 70 of file http2_request.h.
|
inlinestatic |
Create http2_request from parsed headers.
| parsed_headers | Headers decoded from HPACK |
This method separates pseudo-headers (starting with ':') from regular headers and populates the appropriate fields.
Definition at line 131 of file http2_request.h.
References authority, headers, method, path, and scheme.
Referenced by kcenon::network::protocols::http2::http2_server_connection::dispatch_request().

|
inlinenodiscard |
Get request body as UTF-8 string.
Definition at line 96 of file http2_request.h.
|
inlinenodiscard |
Get header value by name (case-insensitive)
| name | Header name to search for |
Definition at line 46 of file http2_request.h.
References headers.
|
inlinenodiscard |
Check if this is a valid HTTP/2 request.
Per RFC 7540 Section 8.1.2.3, requests must include:
Definition at line 110 of file http2_request.h.
| std::string kcenon::network::protocols::http2::http2_request::authority |
Authority (:authority pseudo-header)
Definition at line 36 of file http2_request.h.
Referenced by from_headers().
| std::vector<uint8_t> kcenon::network::protocols::http2::http2_request::body |
Request body from DATA frames.
Definition at line 39 of file http2_request.h.
| std::vector<http_header> kcenon::network::protocols::http2::http2_request::headers |
Regular headers (non-pseudo)
Definition at line 38 of file http2_request.h.
Referenced by from_headers(), get_header(), and kcenon::network::protocols::http2::http2_server_stream::headers().
| std::string kcenon::network::protocols::http2::http2_request::method |
HTTP method (:method pseudo-header)
Definition at line 34 of file http2_request.h.
Referenced by from_headers(), and kcenon::network::protocols::http2::http2_server_stream::method().
| std::string kcenon::network::protocols::http2::http2_request::path |
Request path (:path pseudo-header)
Definition at line 35 of file http2_request.h.
Referenced by from_headers(), and kcenon::network::protocols::http2::http2_server_stream::path().
| std::string kcenon::network::protocols::http2::http2_request::scheme |
Scheme (:scheme pseudo-header)
Definition at line 37 of file http2_request.h.
Referenced by from_headers().