forked from boostorg/beast
New buffer sequence classes are provided to allow full
control over the serialization of chunk-encoded message
payloads:
* chunk_header
A ConstBufferSequence representing the chunk header.
It includes a hexadecimal-encoded size, an optional
set of chunk extensions, and the trailing CRLF
required to denote the end of the chunk header.
This allows the caller to manually serialize the chunk
body in one or more calls to a stream output function.
The caller must also output an object of type `chunk_crlf`
to the stream to indicate the end of the chunk body.
* chunk_crlf
A small ConstBufferSequence that simply represents
the two character sequence "\r\n" (CRLF). This is needed
for the case where the caller wants to output a chunk
body as a series of buffers (i.e. "chunking a chunk").
* chunk_body
A ConstBufferSequence representing a complete chunk.
This includes the size, an optional set of chunk extensions,
a caller provided buffer containing the body, and the
required CRLF that follows.
* chunk_final
A ConstBufferSequence representing a final chunk. It
includes an optional set of caller-provided field trailers
* chunk_extensions
A container for building a set of chunk extensions to use
during serialization. The use of the container is optional,
callers may provide their own buffer containing a correctly
formatted set of chunk extensions, or they may use their
own convenience container which meets the requirements.
The basic_fields container is modified to allow construction
outside the context of a message. The container can be used
to provide trailers to `chunk_final`.
Actions Required:
* Remove references to ChunkDecorators. Use the new chunk-encoding
buffer sequences to manually produce a chunked payload body in
the case where control over the chunk-extensions and/or trailers
is required.
93 lines
3.0 KiB
Plaintext
93 lines
3.0 KiB
Plaintext
[/
|
|
Copyright (c) 2013-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
|
|
|
|
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
]
|
|
|
|
[section Using HTTP]
|
|
|
|
[warning
|
|
Higher level functions such as Basic
|
|
Authentication, mime/multipart encoding, cookies, automatic handling
|
|
of redirects, gzipped transfer encodings, caching, or proxying (to name
|
|
a few) are not directly provided, but nothing stops users from creating
|
|
these features using Beast's HTTP message types.
|
|
]
|
|
|
|
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:
|
|
|
|
[variablelist
|
|
[
|
|
[Message Containers]
|
|
[
|
|
Complete HTTP messages are modeled using the __message__ class,
|
|
with possible user customizations.
|
|
]
|
|
][
|
|
[Stream Reading]
|
|
[
|
|
The functions
|
|
[link beast.ref.beast__http__read `read`],
|
|
[link beast.ref.beast__http__read_header `read_header`],
|
|
[link beast.ref.beast__http__read_some `read_some`],
|
|
[link beast.ref.beast__http__async_read `async_read`],
|
|
[link beast.ref.beast__http__async_read_header `async_read_header`], and
|
|
[link beast.ref.beast__http__async_read_some `async_read_some`]
|
|
read HTTP/1 message data from a
|
|
[link beast.concepts.streams stream].
|
|
]
|
|
][
|
|
[Stream Writing]
|
|
[
|
|
The functions
|
|
[link beast.ref.beast__http__write `write`],
|
|
[link beast.ref.beast__http__write_header `write_header`],
|
|
[link beast.ref.beast__http__write_some `write_some`],
|
|
[link beast.ref.beast__http__async_write `async_write`],
|
|
[link beast.ref.beast__http__async_write_header `async_write_header`], and
|
|
[link beast.ref.beast__http__async_write_some `async_write_some`]
|
|
write HTTP/1 message data to a
|
|
[link beast.concepts.streams stream].
|
|
]
|
|
][
|
|
[Serialization]
|
|
[
|
|
The __serializer__ produces a series of octet buffers
|
|
conforming to the __rfc7230__ wire representation of
|
|
a __message__.
|
|
]
|
|
][
|
|
[Parsing]
|
|
[
|
|
The __parser__ attempts to convert a series of octet
|
|
buffers into a __message__.
|
|
]
|
|
]
|
|
]
|
|
|
|
[note
|
|
This documentation assumes some familiarity with __Asio__ and
|
|
the HTTP protocol specification described in __rfc7230__. Sample
|
|
code and identifiers mentioned in this section is written as if
|
|
these declarations are in effect:
|
|
|
|
[http_snippet_1]
|
|
]
|
|
|
|
[include 04_http/01_primer.qbk]
|
|
[include 04_http/02_message.qbk]
|
|
[include 04_http/03_streams.qbk]
|
|
[include 04_http/04_serializer_streams.qbk]
|
|
[include 04_http/05_parser_streams.qbk]
|
|
[include 04_http/06_serializer_buffers.qbk]
|
|
[include 04_http/07_parser_buffers.qbk]
|
|
[include 04_http/08_chunked_encoding.qbk]
|
|
[include 04_http/09_custom_body.qbk]
|
|
[include 04_http/10_custom_parsers.qbk]
|
|
|
|
[endsect]
|