| Home | Libraries | People | FAQ | More

##### http::message::header_type

The base class used to hold the header portion of the message.

###### Synopsis

    using header_type = header< isRequest, Fields >;

###### Types

Name | Description
--- | ---
allocator_type | The type of allocator used.
const_iterator | A constant iterator to the field sequence.
fields_type | The type representing the fields.
is_request | Indicates if the header is a request or response.
iterator | A constant iterator to the field sequence.
key_compare | A strictly less predicate for comparing keys, using a case-insensitive comparison.
writer | The algorithm used to serialize the header.

###### Member Functions

Name | Description
--- | ---
at | Returns the value for a field, or throws an exception.
begin | Return a const iterator to the beginning of the field sequence.
cbegin | Return a const iterator to the beginning of the field sequence.
cend | Return a const iterator to the end of the field sequence.
clear | Remove all fields from the container.
count | Return the number of fields with the specified name.
end | Return a const iterator to the end of the field sequence.
equal_range | Returns a range of iterators to the fields with the specified name. — Returns a range of iterators to the fields with the specified name.
erase | Remove a field. — Remove all fields with the specified name.
find | Returns an iterator to the case-insensitive matching field. — Returns an iterator to the case-insensitive matching field name.
get_allocator | Return a copy of the allocator associated with the container.
header | Constructor.
insert | Insert a field. —
key_comp | Returns a copy of the key comparison function.
method | Return the request-method verb. — Set the request-method.
method_string | Return the request-method as a string. — Set the request-method.
operator= | Assignment.
operator[] | Returns the value for a field, or `""` if it does not exist. — Returns the value for a case-insensitive matching header, or `""` if it does not exist.
reason | Return the response reason-phrase. — Set the response reason-phrase (deprecated)
result | The response status-code result. — Set the response status-code. — Set the response status-code as an integer.
result_int | The response status-code expressed as an integer.
set | Set a field value, removing any other instances of that field. —
swap | Return a buffer sequence representing the trailers.
target | Returns the request-target string. — Set the request-target string.
version | Return the HTTP-version. — Set the HTTP-version.

###### Protected Member Functions

Name | Description
--- | ---
get_chunked_impl | Returns the chunked Transfer-Encoding setting.
get_keep_alive_impl | Returns the keep-alive setting.
get_method_impl | Returns the request-method string.
get_reason_impl | Returns the response reason-phrase string.
get_target_impl | Returns the request-target string.
has_content_length_impl | Returns `true` if the Content-Length field is present.
set_chunked_impl | Adjusts the chunked Transfer-Encoding value.
set_content_length_impl | Sets or clears the Content-Length field.
set_keep_alive_impl | Adjusts the Connection field.
set_method_impl | Set or clear the method string.
set_reason_impl | Set or clear the reason string.
set_target_impl | Set or clear the target string.

###### Static Members

Name | Description
--- | ---
max_name_size | Maximum field name size.
max_value_size | Maximum field value size.

This container is derived from the `Fields` template type. To understand all of the members of this class it is necessary to view the declaration for the `Fields` type. When using the default fields container, those declarations are in `fields`.

Newly constructed header objects have version set to HTTP/1.1. Newly constructed response objects also have result code set to `status::ok`.

A `header` includes the start-line and header-fields.