Rename to parser (API Change):

* message_parser is renamed to parser
This commit is contained in:
Vinnie Falco committed 2017-07-20 08:12:18 -07:00
1 parent 88600beab0
commit 00667f3cf2
14 files changed
+67 -49

No files matched your search

+1 -1
View File
@@ -63,8 +63,8 @@
[def __header__ [link beast.ref.http__header `header`]]
[def __header_parser__ [link beast.ref.http__header_parser `header_parser`]]
[def __message__ [link beast.ref.http__message `message`]]
[def __message_parser__ [link beast.ref.http__message_parser `message_parser`]]
[def __multi_buffer__ [link beast.ref.multi_buffer `multi_buffer`]]
[def __parser__ [link beast.ref.http__parser `parser`]]
[def __serializer__ [link beast.ref.http__serializer `serializer`]]
Beast is a cross-platform, header-only C++11 library for low-level HTTP
+2 -2
View File
@@ -69,8 +69,8 @@ format using __Asio__. Specifically, the library provides:
][
[Parsing]
[
The __message_parser__ attempts to convert a series of
octet buffers into a __message__.
The __parser__ attempts to convert a series of octet
buffers into a __message__.
]
]
]
+26 -8
View File
@@ -26,15 +26,15 @@ defined types deriving from the basic parser are possible:
[table Parser Implementations
[[Name][Description]]
[[
__message_parser__
__parser__
][
```
/// A parser for a message
/// An HTTP/1 parser for producing a message.
template<
bool isRequest, // `true` to parse an HTTP request
class Body, // The Body type for the resulting message
class Fields> // The type of container representing the fields
class message_parser
class parser
: public basic_parser<...>;
```
]]
@@ -42,7 +42,7 @@ defined types deriving from the basic parser are possible:
__header_parser__
][
```
/// A parser for a header
/// An HTTP/1 parser for producing a header.
template<
bool isRequest, // `true` to parse an HTTP request
class Fields> // The type of container representing the fields
@@ -50,6 +50,24 @@ defined types deriving from the basic parser are possible:
: public basic_parser<...>;
```
]]
[[
[link beast.ref.http__request_parser `request_parser`]
][
```
/// An HTTP/1 parser for producing a request message.
template<class Body, class Fields = fields>
using request_parser = parser<true, Body, Fields>;
```
]]
[[
[link beast.ref.http__response_parser `response_parser`]
][
```
/// An HTTP/1 parser for producing a response message.
template<class Body, class Fields = fields>
using response_parser = parser<false, Body, Fields>;
```
]]
]
[note
@@ -134,8 +152,8 @@ immediate informational response before sending the the message body, which
presumably may be expensive to compute or large. This behavior is described in
[@https://tools.ietf.org/html/rfc7231#section-5.1.1 rfc7231 section 5.1.1].
Handling the Expect field can be implemented easily in a server by constructing
a __message_parser__ to read the header first, then send an informational
HTTP response, and finally read the body using the same parser instance. A
a __parser__ to read the header first, then send an informational HTTP
response, and finally read the body using the same parser instance. A
synchronous version of this server action looks like this:
```
/** Receive a request, handling Expect: 100-continue if present.
@@ -209,7 +227,7 @@ The example that follows implements a synchronous HTTP relay. It uses a
fixed size buffer, to avoid reading in the entire body so that the upstream
connection sees a header without unnecessary latency. This example brings
together all of the concepts discussed so far, it uses both a __serializer__
and a __message_parser__ to achieve its goal:
and a __parser__ to achieve its goal:
```
/** Relay an HTTP message.
@@ -265,7 +283,7 @@ relay(
char buf[2048];
// Create a parser with a buffer body to read from the input.
message_parser<isRequest, buffer_body, Fields> p;
parser<isRequest, buffer_body, Fields> p;
// Create a serializer from the message contained in the parser.
serializer<isRequest, buffer_body, Fields> sr{p.get()};
+2 -2
View File
@@ -7,7 +7,7 @@
[section:parser_buffers Buffer-Oriented Parsing]
In extreme cases, users may wish to create an instance of __message_parser__,
In extreme cases, users may wish to create an instance of __parser__,
__header_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 streams whose interface
@@ -58,7 +58,7 @@ parse_istream(
error_code& ec)
{
// Create the message parser
message_parser<isRequest, Body, Fields> parser;
parser<isRequest, Body, Fields> parser;
do
{
+1 -1
View File
@@ -9,7 +9,7 @@
A [*BodyWriter] provides an online algorithm to transfer a series of zero
or more buffers containing parsed body octets into a message container. The
__message_parser__ creates an instance of this type when needed, and calls into
__parser__ creates an instance of this type when needed, and calls into
it zero or more times to transfer buffers. The interface of [*BodyWriter]
is intended to allow the conversion of buffers into these scenarios for
representation:
+1 -1
View File
@@ -39,7 +39,7 @@
<member><link linkend="beast.ref.http__header">header</link></member>
<member><link linkend="beast.ref.http__header_parser">header_parser</link></member>
<member><link linkend="beast.ref.http__message">message</link></member>
<member><link linkend="beast.ref.http__message_parser">message_parser</link></member>
<member><link linkend="beast.ref.http__parser">parser</link></member>
<member><link linkend="beast.ref.http__no_chunk_decorator">no_chunk_decorator</link></member>
<member><link linkend="beast.ref.http__request">request</link></member>
<member><link linkend="beast.ref.http__request_parser">request_parser</link></member>