This library offers programmers simple and performant models of HTTP messages and their associated operations including synchronous, asynchronous, and buffer-oriented parsing and serialization of messages in the HTTP/1 wire format using __Asio__. Specifically, the library provides:
Interfaces for operating on HTTP messages are structured into several layers. The highest level provides ease of use, while lower levels provide progressively more control, options, and flexibility. At the lowest level customization points are provided, where user defined types can replace parts of the implementation. The layers are arranged thusly:
At the highest level, these free functions send or receive a complete HTTP message in one call. They are designed for ease of use: [link beast.ref.boost__beast__http__read.overload4 `read`], [link beast.ref.boost__beast__http__write.overload4 `write`], [link beast.ref.boost__beast__http__async_read.overload2 `async_read`], and [link beast.ref.boost__beast__http__async_write.overload2 `async_write`].
For more control, callers may take responsibility for managing the required __parser__ or __serializer__ transient state objects. This allows additional configuration such as limiting the number of bytes for message components during parsing, or regulating the size of buffers emitted during output. These functions send or receive complete messages using a serializer or parser: [link beast.ref.boost__beast__http__read.overload2 `read`], [link beast.ref.boost__beast__http__write.overload2 `write`], [link beast.ref.boost__beast__http__async_read.overload1 `async_read`], and [link beast.ref.boost__beast__http__async_write.overload1 `async_write`].
Sometimes it is necessary to first send or receive the HTTP header. For example, to read the header and take action before continuing to read the body. These functions use a __parser__ or __serializer__ to read or write the header: [link beast.ref.boost__beast__http__read_header.overload2 `read_header`], [link beast.ref.boost__beast__http__write_header.overload2 `write_header`], [link beast.ref.boost__beast__http__async_read_header `async_read_header`], and [link beast.ref.boost__beast__http__async_write_header `async_write_header`].
All of the stream operations at higher levels thus far have operated on a complete header or message. At this level it is possible to send and receive messages incrementally. This allows resource constrained implementations to perform work bounded on storage, or allows better control when setting timeouts for example. These functions read or write bounded amounts of data and return the number of bytes transacted: [link beast.ref.boost__beast__http__read_some.overload2 `read_some`], [link beast.ref.boost__beast__http__write_some.overload2 `write_some`], [link beast.ref.boost__beast__http__async_read_some `async_read_some`], and [link beast.ref.boost__beast__http__async_write_some `async_write_some`].
Until now parse and serialize operations apply or remove the chunked transfer coding as needed for message payloads whose size is not known ahead of time. For some domain specific niches, it is necessary to assume direct control over incoming or outgoing chunks in a chunk encoded message payload. For parsing this is achieved by setting hooks using the functions [link beast.ref.boost__beast__http__parser.on_chunk_header `on_chunk_header`] and/or [link beast.ref.boost__beast__http__parser.on_chunk_body `on_chunk_body`]. For serializing callers may first emit the header, and then use these buffer sequence adapters to control the contents of each chunk including [@https://tools.ietf.org/html/rfc7230#section-4.1.1 ['chunk extensions]] and the [@https://tools.ietf.org/html/rfc7230#section-4.1.2 ['trailer-part]]: [link beast.ref.boost__beast__http__chunk_body `chunk_body`], [link beast.ref.boost__beast__http__chunk_crlf `chunk_crlf`], [link beast.ref.boost__beast__http__chunk_header `chunk_header`], and [link beast.ref.boost__beast__http__chunk_last `chunk_last`].