boost::http::fields
A modifiable container of HTTP fields.
Synopsis
Declared in <boost/http/fields.hpp>
class fields final
: public fields_base
Description
This container owns a collection of HTTP fields, represented by a buffer which is managed by performing dynamic memory allocations as needed. The contents may be inspected and modified, and the implementation maintains a useful invariant: changes to the fields always leave it in a valid state.
Example
fields fs;
fs.set(field::host, "example.com");
fs.set(field::accept_encoding, "gzip, deflate, br");
fs.set(field::cache_control, "no-cache");
assert(fs.buffer() ==
"Host: example.com\r\n"
"Accept-Encoding: gzip, deflate, br\r\n"
"Cache-Control: no-cache\r\n"
"\r\n");
Types
Name |
Description |
A bidirectional iterator to HTTP fields. |
|
A view to an HTTP field. |
|
A bidirectional reverse iterator to HTTP fields. |
|
A forward range of matching fields. |
|
A value type which represent an HTTP field. |
|
A bidirectional iterator to HTTP fields. |
|
A view to an HTTP field. |
|
A bidirectional iterator to HTTP fields. |
Member Functions
Name |
Description |
|
Constructor. |
Assignment. |
|
Append a header. |
|
Return the value of a field, or throws an exception. |
|
Return an iterator to the beginning. |
|
Return a string view representing the serialized data. |
|
Return the total number of bytes allocated by the container. |
|
Clear contents while preserving the capacity. |
|
Return the number of matching fields. |
|
Return an iterator to the end. |
|
|
|
Return true if a field exists. |
|
Return an iterator to the matching element if it exists. |
|
Return a forward range containing values for all matching fields. |
|
Return an iterator to the matching element if it exists. |
|
Insert a header. |
|
Return the maximum allowed capacity in bytes. |
|
Return a reverse iterator to the beginning. |
|
Return a reverse iterator to the end. |
|
Adjust the capacity without changing the size. |
|
Set a header value. |
|
Set the maximum allowed capacity in bytes. |
|
Remove excess capacity. |
|
Return the number of fields in the container. |
|
Swap. |
|
Return the value of a field or a default if missing. |
See Also
fields_base.
Created with MrDocs