http_headers.hpp File Reference
`#include <restinio/impl/include_fmtlib.hpp>`
`#include <restinio/impl/string_caseless_compare.hpp>`
`#include <restinio/exception.hpp>`
`#include <restinio/string_view.hpp>`
`#include <restinio/optional.hpp>`
`#include <restinio/common_types.hpp>`
`#include <http_parser.h>`
`#include <iosfwd>`
`#include <string>`
`#include <vector>`
`#include <algorithm>`

Go to the source code of this file.

## Classes

class | restinio::http_header_field_t
| A single header field. More...
class | restinio::http_header_fields_t
| Header fields map. More...
struct | restinio::http_header_common_t
| Req/Resp headers common data. More...
class | restinio::http_method_id_t
| A type for representation of HTTP method ID. More...
class | restinio::default_http_methods_t
| The default implementation for http_method_mapper. More...
struct | restinio::http_request_header_t
| Req header. More...
class | restinio::http_status_code_t
| A handy wrapper for HTTP response status code. More...
class | restinio::http_status_line_t
| HTTP response header status line. More...
struct | restinio::http_response_header_t
| Resp header. More...

## Namespaces

namespace | restinio
namespace | restinio::impl
namespace | restinio::status_code

## Macros

#define | RESTINIO_HTTP_FIELDS_MAP(RESTINIO_GEN)
#define | RESTINIO_HTTP_FIELD_GEN(name, ignored) name,
#define | RESTINIO_HTTP_CHECK_FOR_FIELD(field_id, candidate_field_name)
#define | RESTINIO_HTTP_FIELD_STR_GEN(name, string_name) case http_field_t::name: result = #string_name; break;

## Typedefs

using | restinio::http_field = http_field_t
| Helper alies to omitt `_t` suffix. More...

## Enumerations

enum class | restinio::http_field_t : std::uint8_t { restinio::RESTINIO_HTTP_FIELD_GEN , restinio::field_unspecified }
| C++ enum that repeats nodejs c-style enum. More...

## Functions

void | restinio::impl::append_last_field_accessor (http_header_fields_t &, string_view_t)
RFC 2616 statuses.
Codes defined by RFC 2616: https://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html#sec6.1.1.
http_status_line_t | restinio::status_continue ()
http_status_line_t | restinio::status_switching_protocols ()
http_status_line_t | restinio::status_ok ()
http_status_line_t | restinio::status_created ()
http_status_line_t | restinio::status_accepted ()
http_status_line_t | restinio::status_non_authoritative_information ()
http_status_line_t | restinio::status_no_content ()
http_status_line_t | restinio::status_reset_content ()
http_status_line_t | restinio::status_partial_content ()
http_status_line_t | restinio::status_multiple_choices ()
http_status_line_t | restinio::status_moved_permanently ()
http_status_line_t | restinio::status_found ()
http_status_line_t | restinio::status_see_other ()
http_status_line_t | restinio::status_not_modified ()
http_status_line_t | restinio::status_use_proxy ()
http_status_line_t | restinio::status_temporary_redirect ()
http_status_line_t | restinio::status_bad_request ()
http_status_line_t | restinio::status_unauthorized ()
http_status_line_t | restinio::status_payment_required ()
http_status_line_t | restinio::status_forbidden ()
http_status_line_t | restinio::status_not_found ()
http_status_line_t | restinio::status_method_not_allowed ()
http_status_line_t | restinio::status_not_acceptable ()
http_status_line_t | restinio::status_proxy_authentication_required ()
http_status_line_t | restinio::status_request_time_out ()
http_status_line_t | restinio::status_conflict ()
http_status_line_t | restinio::status_gone ()
http_status_line_t | restinio::status_length_required ()
http_status_line_t | restinio::status_precondition_failed ()
http_status_line_t | restinio::status_payload_too_large ()
http_status_line_t | restinio::status_uri_too_long ()
http_status_line_t | restinio::status_unsupported_media_type ()
http_status_line_t | restinio::status_requested_range_not_satisfiable ()
http_status_line_t | restinio::status_expectation_failed ()
http_status_line_t | restinio::status_internal_server_error ()
http_status_line_t | restinio::status_not_implemented ()
http_status_line_t | restinio::status_bad_gateway ()
http_status_line_t | restinio::status_service_unavailable ()
http_status_line_t | restinio::status_gateway_time_out ()
http_status_line_t | restinio::status_http_version_not_supported ()
Additional statuses.
Not covered with RFC 2616.
http_status_line_t | restinio::status_permanent_redirect ()
http_status_line_t | restinio::status_processing ()
http_status_line_t | restinio::status_multi_status ()
http_status_line_t | restinio::status_unprocessable_entity ()
http_status_line_t | restinio::status_locked ()
http_status_line_t | restinio::status_failed_dependency ()
http_status_line_t | restinio::status_insufficient_storage ()
http_status_line_t | restinio::status_precondition_required ()
http_status_line_t | restinio::status_too_many_requests ()
http_status_line_t | restinio::status_request_header_fields_too_large ()
http_status_line_t | restinio::status_network_authentication_required ()

## Variables

RFC 2616 status code list.
Codes defined by RFC 2616: https://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html#sec6.1.1.
constexpr http_status_code_t | restinio::status_code::continue_ { 100 }
constexpr http_status_code_t | restinio::status_code::switching_protocols { 101 }
constexpr http_status_code_t | restinio::status_code::ok { 200 }
constexpr http_status_code_t | restinio::status_code::created { 201 }
constexpr http_status_code_t | restinio::status_code::accepted { 202 }
constexpr http_status_code_t | restinio::status_code::non_authoritative_information { 203 }
constexpr http_status_code_t | restinio::status_code::no_content { 204 }
constexpr http_status_code_t | restinio::status_code::reset_content { 205 }
constexpr http_status_code_t | restinio::status_code::partial_content { 206 }
constexpr http_status_code_t | restinio::status_code::multiple_choices { 300 }
constexpr http_status_code_t | restinio::status_code::moved_permanently { 301 }
constexpr http_status_code_t | restinio::status_code::found { 302 }
constexpr http_status_code_t | restinio::status_code::see_other { 303 }
constexpr http_status_code_t | restinio::status_code::not_modified { 304 }
constexpr http_status_code_t | restinio::status_code::use_proxy { 305 }
constexpr http_status_code_t | restinio::status_code::temporary_redirect { 307 }
constexpr http_status_code_t | restinio::status_code::bad_request { 400 }
constexpr http_status_code_t | restinio::status_code::unauthorized { 401 }
constexpr http_status_code_t | restinio::status_code::payment_required { 402 }
constexpr http_status_code_t | restinio::status_code::forbidden { 403 }
constexpr http_status_code_t | restinio::status_code::not_found { 404 }
constexpr http_status_code_t | restinio::status_code::method_not_allowed { 405 }
constexpr http_status_code_t | restinio::status_code::not_acceptable { 406 }
constexpr http_status_code_t | restinio::status_code::proxy_authentication_required { 407 }
constexpr http_status_code_t | restinio::status_code::request_time_out { 408 }
constexpr http_status_code_t | restinio::status_code::conflict { 409 }
constexpr http_status_code_t | restinio::status_code::gone { 410 }
constexpr http_status_code_t | restinio::status_code::length_required { 411 }
constexpr http_status_code_t | restinio::status_code::precondition_failed { 412 }
constexpr http_status_code_t | restinio::status_code::payload_too_large { 413 }
constexpr http_status_code_t | restinio::status_code::uri_too_long { 414 }
constexpr http_status_code_t | restinio::status_code::unsupported_media_type { 415 }
constexpr http_status_code_t | restinio::status_code::requested_range_not_satisfiable { 416 }
constexpr http_status_code_t | restinio::status_code::expectation_failed { 417 }
constexpr http_status_code_t | restinio::status_code::internal_server_error { 500 }
constexpr http_status_code_t | restinio::status_code::not_implemented { 501 }
constexpr http_status_code_t | restinio::status_code::bad_gateway { 502 }
constexpr http_status_code_t | restinio::status_code::service_unavailable { 503 }
constexpr http_status_code_t | restinio::status_code::gateway_time_out { 504 }
constexpr http_status_code_t | restinio::status_code::http_version_not_supported { 505 }
Additional status codes.
Codes not covered with RFC 2616.
constexpr http_status_code_t | restinio::status_code::permanent_redirect { 308 }
constexpr http_status_code_t | restinio::status_code::processing { 102 }
constexpr http_status_code_t | restinio::status_code::multi_status { 207 }
constexpr http_status_code_t | restinio::status_code::unprocessable_entity { 422 }
constexpr http_status_code_t | restinio::status_code::locked { 423 }
constexpr http_status_code_t | restinio::status_code::failed_dependency { 424 }
constexpr http_status_code_t | restinio::status_code::insufficient_storage { 507 }
constexpr http_status_code_t | restinio::status_code::precondition_required { 428 }
constexpr http_status_code_t | restinio::status_code::too_many_requests { 429 }
constexpr http_status_code_t | restinio::status_code::request_header_fields_too_large { 431 }
constexpr http_status_code_t | restinio::status_code::network_authentication_required { 511 }
#define | RESTINIO_HEADER_FIELDS_DEFAULT_RESERVE_COUNT 4
#define | RESTINIO_HTTP_METHOD_MAP(RESTINIO_GEN)
| HTTP methods mapping with nodejs http methods. More...
#define | RESTINIO_HTTP_METHOD_FUNC_GEN(func_name, nodejs_code, method_name)
#define | RESTINIO_HTTP_METHOD_FUNC_GEN(func_name, nodejs_code, method_name) case nodejs_code : result = func_name(); break;
enum class | restinio::http_connection_header_t : std::uint8_t { restinio::keep_alive , restinio::close , restinio::upgrade }
| Values for conection header field. More...
http_field_t | restinio::string_to_field (string_view_t field) noexcept
| Helper function to get method string name. More...
const char * | restinio::field_to_string (http_field_t f) noexcept
| Helper sunction to get method string name. More...
std::ostream & | restinio::operator<< (std::ostream &to, const http_method_id_t &m)
constexpr http_method_id_t | restinio::http_method_unknown ()
std::ostream & | restinio::operator<< (std::ostream &o, const http_status_line_t &status_line)

## Macro Definition Documentation

## RESTINIO_HEADER_FIELDS_DEFAULT_RESERVE_COUNT

#define RESTINIO_HEADER_FIELDS_DEFAULT_RESERVE_COUNT 4

Definition at line 668 of file http_headers.hpp.

## RESTINIO_HTTP_CHECK_FOR_FIELD

#define RESTINIO_HTTP_CHECK_FOR_FIELD | ( |  | field_id,
|  |  | candidate_field_name
| ) |  |

Value:
if( impl::is_equal_caseless(field_name, #candidate_field_name , field_name_size ) ) \
return http_field_t:: field_id;
restinio::impl::is_equal_caseless
bool is_equal_caseless(const char *a, const char *b, std::size_t size) noexcept
Comparator for fields names.
Definition: string_caseless_compare.hpp:40

## RESTINIO_HTTP_FIELD_GEN

#define RESTINIO_HTTP_FIELD_GEN | ( |  | name,
|  |  | ignored
| ) |  | name,

Definition at line 234 of file http_headers.hpp.

## RESTINIO_HTTP_FIELD_STR_GEN

#define RESTINIO_HTTP_FIELD_STR_GEN | ( |  | name,
|  |  | string_name
| ) |  | case http_field_t::name: result = #string_name; break;

## RESTINIO_HTTP_FIELDS_MAP

#define RESTINIO_HTTP_FIELDS_MAP | ( |  | RESTINIO_GEN | ) |

Definition at line 34 of file http_headers.hpp.

## RESTINIO_HTTP_METHOD_FUNC_GEN [1/2]

#define RESTINIO_HTTP_METHOD_FUNC_GEN | ( |  | func_name,
|  |  | nodejs_code,
|  |  | method_name
| ) |  |

Value:
inline constexpr http_method_id_t func_name() { \
return { nodejs_code, #method_name }; \
}

Definition at line 1799 of file http_headers.hpp.

## RESTINIO_HTTP_METHOD_FUNC_GEN [2/2]

#define RESTINIO_HTTP_METHOD_FUNC_GEN | ( |  | func_name,
|  |  | nodejs_code,
|  |  | method_name
| ) |  | case nodejs_code : result = func_name(); break;

Definition at line 1799 of file http_headers.hpp.

## RESTINIO_HTTP_METHOD_MAP

#define RESTINIO_HTTP_METHOD_MAP | ( |  | RESTINIO_GEN | ) |

HTTP methods mapping with nodejs http methods.

Definition at line 1652 of file http_headers.hpp.