Beast Logo

PrevUpHomeNext

http::fields

A typical HTTP header fields container.

Synopsis

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

using fields = basic_fields< std::allocator< char >>;
Types

Name

Description

allocator_type

The type of allocator used.

key_compare

A strictly less predicate for comparing keys, using a case-insensitive comparison.

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.

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.

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[]

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

Swap this container with another.

Protected Member Functions

Name

Description

basic_fields

Constructor.

Move constructor.

Copy constructor.

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.

operator=

Move assignment.

Copy assignment.

prepare_payload_impl

Adjusts the payload related fields.

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.

~basic_fields

Destructor.

Friends

Name

Description

swap

Swap two field containers.

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. This must meet the requirements of Allocator.

Convenience header <beast/http.hpp>


PrevUpHomeNext