RESTinio
|
Req header. More...
#include <http_headers.hpp>
Public Member Functions | |
http_request_header_t ()=default | |
http_request_header_t (http_method_id_t method, std::string request_target_) | |
http_method_id_t | method () const noexcept |
void | method (http_method_id_t m) noexcept |
const std::string & | request_target () const noexcept |
void | request_target (std::string t) |
void | append_request_target (const char *at, size_t length) |
Helpfull function for using in parser callback. More... | |
string_view_t | path () const noexcept |
Request URL-structure. More... | |
string_view_t | query () const noexcept |
Get the query part of the request URL. More... | |
string_view_t | fragment () const |
Get the fragment part of the request URL. More... | |
Public Member Functions inherited from restinio::http_header_common_t | |
std::uint64_t | content_length () const noexcept |
Length of body of an http-message. More... | |
void | content_length (std::uint64_t l) noexcept |
bool | should_keep_alive () const noexcept |
void | should_keep_alive (bool keep_alive) noexcept |
http_connection_header_t | connection () const |
Get the value of 'connection' header field. More... | |
void | connection (http_connection_header_t ch) noexcept |
Set the value of 'connection' header field. More... | |
std::uint16_t | http_major () const noexcept |
Http version. More... | |
void | http_major (std::uint16_t v) noexcept |
std::uint16_t | http_minor () const noexcept |
void | http_minor (std::uint16_t v) noexcept |
Public Member Functions inherited from restinio::http_header_fields_t | |
http_header_fields_t () | |
http_header_fields_t (const http_header_fields_t &)=default | |
http_header_fields_t (http_header_fields_t &&)=default | |
virtual | ~http_header_fields_t () |
http_header_fields_t & | operator= (const http_header_fields_t &)=default |
http_header_fields_t & | operator= (http_header_fields_t &&)=default |
void | swap_fields (http_header_fields_t &http_header_fields) |
bool | has_field (string_view_t field_name) const noexcept |
Check field by name. More... | |
bool | has_field (http_field_t field_id) const noexcept |
Check field by field-id. More... | |
void | set_field (http_header_field_t http_header_field) |
Set header field via http_header_field_t. More... | |
void | set_field (std::string field_name, std::string field_value) |
Set field with string pair. More... | |
void | set_field (http_field_t field_id, std::string field_value) |
Set field with id-value pair. More... | |
void | add_field (http_field_t field_id, std::string field_value) |
Add a field in the form of id-value pair. More... | |
void | add_field (std::string field_name, std::string field_value) |
Add a field in the form of name-value pair. More... | |
void | add_field (http_header_field_t http_header_field) |
Add a field in the form of http_header_field object. More... | |
void | append_field (string_view_t field_name, string_view_t field_value) |
Append field with name. More... | |
void | append_field (http_field_t field_id, string_view_t field_value) |
Append field with id. More... | |
const std::string & | get_field (string_view_t field_name) const |
Get field by name. More... | |
nullable_pointer_t< const std::string > | try_get_field (string_view_t field_name) const noexcept |
Try to get the value of a field by field name. More... | |
const std::string & | get_field (http_field_t field_id) const |
Get field by id. More... | |
nullable_pointer_t< const std::string > | try_get_field (http_field_t field_id) const noexcept |
Try to get the value of a field by field ID. More... | |
std::string | get_field_or (string_view_t field_name, string_view_t default_value) const |
Get field value by field name or default value if the field not found. More... | |
std::string | get_field_or (string_view_t field_name, std::string &&default_value) const |
Get field value by field name or default value if the field not found. More... | |
auto | get_field_or (string_view_t field_name, const char *default_value) const |
Get field by name or default value if the field not found. More... | |
auto | get_field_or (string_view_t field_name, const std::string &default_value) const |
Get field by name or default value if the field not found. More... | |
std::string | get_field_or (http_field_t field_id, string_view_t default_value) const |
Get field by id or default value if the field not found. More... | |
auto | get_field_or (http_field_t field_id, const char *default_value) const |
Get field by id or default value if the field not found. More... | |
auto | get_field_or (http_field_t field_id, const std::string &default_value) const |
Get field by id or default value if the field not found. More... | |
std::string | get_field_or (http_field_t field_id, std::string &&default_value) const |
Get field by id or default value if the field not found. More... | |
bool | remove_field (string_view_t field_name) noexcept |
Remove field by name. More... | |
bool | remove_field (http_field_t field_id) noexcept |
Remove field by id. More... | |
std::size_t | remove_all_of (string_view_t field_name) noexcept |
Remove all occurences of a field with specified name. More... | |
std::size_t | remove_all_of (http_field_t field_id) noexcept |
Remove all occurences of a field with specified id. More... | |
template<typename Lambda > | |
void | for_each_field (Lambda &&lambda) const noexcept(noexcept(lambda(std::declval< const http_header_field_t &>()))) |
Enumeration of fields. More... | |
template<typename Lambda > | |
void | for_each_value_of (http_field_t field_id, Lambda &&lambda) const noexcept(noexcept(lambda(std::declval< const string_view_t &>()))) |
Enumeration of each value of a field. More... | |
template<typename Lambda > | |
void | for_each_value_of (string_view_t field_name, Lambda &&lambda) const noexcept(noexcept(lambda(std::declval< const string_view_t &>()))) |
Enumeration of each value of a field. More... | |
const_iterator | begin () const noexcept |
const_iterator | end () const noexcept |
auto | fields_count () const noexcept |
string_view_t | value_of (string_view_t name) const |
Get the value of a field or throw if the field not found. More... | |
string_view_t | value_of (http_field_t field_id) const |
Get the value of a field or throw if the field not found. More... | |
optional_t< string_view_t > | opt_value_of (string_view_t name) const noexcept |
Get optional value of a field. More... | |
optional_t< string_view_t > | opt_value_of (http_field_t field_id) const noexcept |
Get optional value of a field. More... | |
Static Public Member Functions | |
static std::size_t | memchr_helper (int chr, const char *from, std::size_t size) |
Static Public Member Functions inherited from restinio::http_header_fields_t | |
static constexpr handling_result_t | continue_enumeration () noexcept |
static constexpr handling_result_t | stop_enumeration () noexcept |
Private Attributes | |
http_method_id_t | m_method { http_method_get() } |
std::string | m_request_target |
std::size_t | m_query_separator_pos { 0 } |
std::size_t | m_fragment_separator_pos { 0 } |
Additional Inherited Members | |
Public Types inherited from restinio::http_header_fields_t | |
enum | handling_result_t { handling_result_t::continue_enumeration, handling_result_t::stop_enumeration } |
The result of handling yet another field value. More... | |
using | fields_container_t = std::vector< http_header_field_t > |
using | const_iterator = fields_container_t::const_iterator |
Type of const_iterator for enumeration of fields. More... | |
Req header.
Definition at line 1857 of file http_headers.hpp.
|
default |
|
inline |
Definition at line 1872 of file http_headers.hpp.
|
inline |
Helpfull function for using in parser callback.
Definition at line 1954 of file http_headers.hpp.
|
inline |
Get the fragment part of the request URL.
If request target is /sobjectizerteam/json_dto-0.2#markdown-header-what-is-json_dto
, then function returns string view on 'markdown-header-what-is-json_dto' part.
Definition at line 1941 of file http_headers.hpp.
|
inlinestatic |
Definition at line 1861 of file http_headers.hpp.
|
inlinenoexcept |
Definition at line 1881 of file http_headers.hpp.
|
inlinenoexcept |
Definition at line 1885 of file http_headers.hpp.
|
inlinenoexcept |
Request URL-structure.
Get the path part of the request URL.
If request target is /weather/temperature?from=2012-01-01&to=2012-01-10
, then function returns string view on '/weather/temperature' part.
Definition at line 1913 of file http_headers.hpp.
|
inlinenoexcept |
Get the query part of the request URL.
If request target is /weather/temperature?from=2012-01-01&to=2012-01-10
, then function returns string view on 'from=2012-01-01&to=2012-01-10' part.
Definition at line 1924 of file http_headers.hpp.
|
inlinenoexcept |
Definition at line 1889 of file http_headers.hpp.
|
inline |
Definition at line 1893 of file http_headers.hpp.
|
private |
Definition at line 1984 of file http_headers.hpp.
|
private |
Definition at line 1981 of file http_headers.hpp.
|
private |
Definition at line 1983 of file http_headers.hpp.
|
private |
Definition at line 1982 of file http_headers.hpp.