Commit Graph

240 Commits

Author SHA1 Message Date
Vinnie Falco 6832bd57d3 Add basic_parser_v1::reset 2017-07-20 08:12:13 -07:00
Vinnie Falco 83556937f6 Add on_body_what parser callback (API Change):
These changes support parsing the headers separately from the body.

* on_headers now returns void
* on_body_what is a new required callback which returns body_what
2017-07-20 08:12:13 -07:00
Vinnie Falco ac07d0c3ed Fix parser traits detection (API Change):
basic_parser_v1 now requires that all callbacks appropriate
to the message are present and have the correct signatures.
Compile errors will result from compiling parsers which are
missing callbacks.
2017-07-20 08:12:13 -07:00
Vinnie Falco e45a6418ee Tidy up documentation:
fix #135

* Fix broken references
* Move doc debug headers to extras/
* Add rfc7230 utility classes to quick reference
2017-07-20 08:12:13 -07:00
Vinnie Falco 81cd98ece5 Tidy up basic_headers for documentation 2017-07-20 08:12:13 -07:00
Vinnie Falco a4d8a154b1 Refine message class hierarchy:
Two new objects, request_headers and response_headers,
represent the portion of HTTP messages excluding the body.
2017-07-20 08:12:13 -07:00
Vinnie Falco 056d6b94c2 Rework HTTP concepts (API Change):
fix #139, fix #140

* Writer uses write instead of operator()
* Refactor traits to use void_t
* Remove is_ReadableBody, is_WritableBody
* Add has_reader, has_writer, is_Reader, is_Writer
* More friendly compile errors on failed concept checks
2017-07-20 08:12:13 -07:00
Vinnie Falco f110e51dd1 HTTP Reader (API Change):
fix #114, fix #117, fix #136

* Added init() to Reader requirements
* Reader must be nothrow constructible
* Reader is now constructed right before reading the body
  - The message passed on construction is filled in
2017-07-20 08:12:13 -07:00
Vinnie Falco 35d1ee54bc Parser callbacks may not throw (API Change) 2017-07-20 08:12:13 -07:00
Vinnie Falco 6732af5822 Add basic_streambuf::alloc_size
fix #133
2017-07-20 08:12:13 -07:00
Vinnie Falco 92e7afb801 Fix basic_streambuf::capacity 2017-07-20 08:12:13 -07:00
Vinnie Falco 52be0dd06e Tidying:
fix #85

* Remove unnecessary boost/system includes
* Remove unused headers_type from write_preparation
* Use braced-init style construction
* handler_alloc doc update
2017-07-20 08:12:13 -07:00
Vinnie Falco 8918b2aceb Set version to 1.0.0-b16 2017-07-20 08:12:13 -07:00
Vinnie Falco 0eb3605232 Refactor base_parser_v1 callback traits:
When the derived class provides a member function with the
corresponding callback name, but the signature is different,
a compile error will be generated instead of silently ignoring
the member function.
2017-07-20 08:12:13 -07:00
Vinnie Falco 2106f364f6 Add pause option to on_headers interface:
* on_headers returns enum body_what
* body_what::pause lets caller receive headers during the parse
2017-07-20 08:12:12 -07:00
Vinnie Falco ce18124566 Improve first line serialization 2017-07-20 08:12:12 -07:00
Vinnie Falco a26a8ea433 Constrain parser_v1 constructor 2017-07-20 08:12:12 -07:00
Vinnie Falco bca43529b0 Refine Parser concept:
* Parser is not HTTP-specific
* parse algorithms are in their own header
* Update documentation
2017-07-20 08:12:12 -07:00
Vinnie Falco 18eeddfab6 Fix on_headers called twice from basic_parser_v1 2017-07-20 08:12:12 -07:00
Vinnie Falco 5855b34d6e Make auto_fragment a boolean option 2017-07-20 08:12:12 -07:00
Vinnie Falco 1156b483c4 Rename to write_buffer_size 2017-07-20 08:12:12 -07:00
Vinnie Falco 74f9211366 Frame processing routines are member functions 2017-07-20 08:12:12 -07:00
Vinnie Falco fbc8ddbc81 Make value optional in param-list 2017-07-20 08:12:12 -07:00
Vinnie Falco ad966d6217 Set version to 1.0.0-b15 2017-07-20 08:12:12 -07:00
Radoslaw Zarzynski bc665ee1ec Fix handling empty HTTP headers in parser_v1.hpp
This patch rectifies flush() of beast::http::parser_v1
to properly handle the case when an HTTP header has
empty value.

Without the fix an empty-valued HTTP header is being
concatenated with the header directly following it.
This situation can be replicated using eg. curl:

  curl <url> -H "X-First;" -H "X-Second: bla"

What Beast's client would see is a single header named
as "X-FirstX-Second".
2017-07-20 08:12:12 -07:00
Vinnie Falco 6b0b016b21 Tidy up error types:
* Restructure header material
* Clean up namespace type injections
* Remove extraneous 'success' constants
2017-07-20 08:12:12 -07:00
Vinnie Falco f2a283ed10 Tidy up DynamicBuffer requirements 2017-07-20 08:12:12 -07:00
Vinnie Falco 9135cdff1a Fix message_v1 constructor 2017-07-20 08:12:12 -07:00
Vinnie Falco 62bd4bb13f rfc7230 section 3.3.2 compliance 2017-07-20 08:12:12 -07:00
Vinnie Falco 0a347f2b25 Set version to 1.0.0-b14 2017-07-20 08:12:12 -07:00
Vinnie Falco 9cc65c8850 Update and tidy documentation 2017-07-20 08:12:12 -07:00
Vinnie Falco dff2751c07 Use BOOST_ASSERT 2017-07-20 08:12:09 -07:00
Vinnie Falco 58d3ea6548 Don't rely on undefined behavior 2017-07-20 08:12:09 -07:00
Vinnie Falco 41a8342d3b Better WebSocket decorator:
* Caller provided type can omit one or both overloads
* Omitted overloads yield default behavior
* Documentation no longer refers to a detail type
2017-07-20 08:12:09 -07:00
Vinnie Falco 0c0b2f2545 Add missing rebind to handler_alloc 2017-07-20 08:12:09 -07:00
Vinnie Falco dfea8ff266 Set version to 1.0.0-b13 2017-07-20 08:12:09 -07:00
Vinnie Falco fda1493565 Set version to 1.0.0-b12 2017-07-20 08:12:09 -07:00
Vinnie Falco 187d0c954a Set version to 1.0.0-b11 2017-07-20 08:12:09 -07:00
Vinnie Falco 3938e5d9ed Rename to DynamicBuffer (fix #47) 2017-07-20 08:12:09 -07:00
Vinnie Falco 3518e4861b Number error codes from 1 (fix #54) 2017-07-20 08:12:09 -07:00
Vinnie Falco c17f467601 Restyle sources 2017-07-20 08:12:09 -07:00
Vinnie Falco 9c11d3fc33 Set URI in generated WebSocket Upgrade requests (fix #64):
The 'resource' parameter in the call to stream::handshake is
used when building the HTTP request to perform the upgrade.
2017-07-20 08:12:09 -07:00
Vinnie Falco e75fb7a4d4 Fix integer warnings in 64-bit Windows build 2017-07-20 08:12:09 -07:00
Vinnie Falco fc677536bf Set version to 1.0.0-b10 2017-07-20 08:12:07 -07:00
Ties Jan Hefting c07ba6aeeb Fix warnings 2017-07-20 08:12:07 -07:00
Vinnie Falco 728e7f648f Set version to 1.0.0-b9 2017-07-20 08:12:07 -07:00
Vinnie Falco e6f1a765a1 Set version to 1.0.0-b8 2017-07-20 08:12:07 -07:00
Vinnie Falco 1947cb4e30 Fix rfc2616 Section 4.2 compliance:
basic_headers no longer combines fields with the same name by appending
a comma and concatenating the two values together. This was breaking
certain header fields which expect each value to be distinct, such as
the "Set-Cookie" header.

Now the container behaves more like a multi set with respect to insertion
of multiple values with the same field name. Additional member functions
are provided to provide extra functionality.
2017-07-20 08:12:07 -07:00
Vinnie Falco 908ac75f7c Set Beast version to 1.0.0-b7 2017-07-20 08:12:07 -07:00
Vinnie Falco 344e4c942c Add skip_body parser option 2017-07-20 08:12:07 -07:00