| Home | Libraries | People | FAQ | More

#### http::basic_fields

A container for storing HTTP header fields.

##### Synopsis

Defined in header `<boost/beast/http/fields.hpp>`

    template<
        class Allocator>
    class basic_fields

##### Types

Name | Description
--- | ---
allocator_type | The type of allocator used.
value_type | The type of element used to represent a field.
const_iterator | A constant iterator to the field sequence.
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.
basic_fields | Constructor. Move constructor. Copy constructor.
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.
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.
insert | Insert a field.
key_comp | Returns a copy of the key comparison function.
operator= | Move assignment. Copy 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.
set | Set a field value, removing any other instances of that field.
swap | Return a buffer sequence representing the trailers.
~basic_fields | Destructor.

##### 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.

##### Friends

Name | Description
--- | ---
swap | Swap two field containers.

##### Description

This container is designed to store the field value pairs that make up the fields and trailers in an HTTP message. Objects of this type are iterable, with each element holding the field name and field value. Field names are stored as-is, but comparisons are case-insensitive. The container behaves as a `std::multiset`; there will be a separate value for each occurrence of the same field name. When the container is iterated the fields are presented in the order of insertion, with fields having the same name following each other consecutively. Meets the requirements of Fields

##### Template Parameters

Type | Description
--- | ---
`Allocator` | The allocator to use.

Convenience header `<boost/beast/http.hpp>`