forked from boostorg/beast
Documentation work
This commit is contained in:
1 parent
d4ec693a61
commit
9d5d4d56a4
46 files changed
+1264
-153
No files matched your search
@@ -0,0 +1,63 @@
|
||||
[/
|
||||
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:parser_buffers Buffer-Oriented Parsing]
|
||||
|
||||
In some cases, users may wish to create an instance of __parser__, or a
|
||||
user-defined type derived from __basic_parser__ and invoke its methods
|
||||
directly instead of using the provided stream algorithms. This could be
|
||||
useful for implementing algorithms on objects whose interface does not
|
||||
conform to any __Stream__. For example, a
|
||||
[@http://zeromq.org/ *ZeroMQ* socket].
|
||||
The basic parser interface is interactive; the caller invokes the function
|
||||
[link beast.ref.http__basic_parser.put `basic_parser::put`]
|
||||
repeatedly with buffers until an error occurs or the parsing is done. The
|
||||
function
|
||||
[link beast.ref.http__basic_parser.put_eof `basic_parser::put_eof`]
|
||||
Is used when the caller knows that there will never be more data (for example,
|
||||
if the underlying connection is closed),
|
||||
|
||||
[heading Parser Options]
|
||||
|
||||
The parser provides two options which may be set before parsing begins:
|
||||
|
||||
[table Parser Options
|
||||
[[Name][Default][Description]]
|
||||
[[
|
||||
[link beast.ref.http__basic_parser.eager.overload2 `eager`]
|
||||
][
|
||||
`false`
|
||||
][
|
||||
Normally the parser returns after successfully parsing a structured
|
||||
element (header, chunk header, or chunk body) even if there are octets
|
||||
remaining in the input. This is necessary when attempting to parse the
|
||||
header first, or when the caller wants to inspect information which may
|
||||
be invalidated by subsequent parsing, such as a chunk extension. The
|
||||
`eager` option controls whether the parser keeps going after parsing
|
||||
structured element if there are octets remaining in the buffer and no
|
||||
error occurs. This option is automatically set or cleared during certain
|
||||
stream operations to improve performance with no change in functionality.
|
||||
]]
|
||||
[[
|
||||
[link beast.ref.http__basic_parser.skip.overload2 `skip`]
|
||||
][
|
||||
`false`
|
||||
][
|
||||
This option controls whether or not the parser expects to see an HTTP
|
||||
body, regardless of the presence or absence of certain fields such as
|
||||
Content-Length or a chunked Transfer-Encoding. Depending on the request,
|
||||
some responses do not carry a body. For example, a 200 response to a
|
||||
[@https://tools.ietf.org/html/rfc7231#section-4.3.6 CONNECT] request
|
||||
from a tunneling proxy, or a response to a
|
||||
[@https://tools.ietf.org/html/rfc7231#section-4.3.2 HEAD] request.
|
||||
In these cases, callers may use this function inform the parser that
|
||||
no body is expected. The parser will consider the message complete
|
||||
after the header has been received.
|
||||
]]
|
||||
]
|
||||
|
||||
[endsect]
|
||||
Reference in new issue
Block a user