1483 Commits
Author SHA1 Message Date
Vinnie Falco e8be3fd7d3 New HTTP interfaces (API Change):
fix #123
fix #154
fix #265

This completely replaces the HTTP parser used to read and
parse incoming messages. The new version is faster than
the old one, and written in fewer lines. A summary of
changes:

* parse and async_parse renamed to read and async_read

* basic_parser is optimized for linear buffers,
  use flat_streambuf for the best performance with these
  functions:

  - http::read
  - http::read_some
  - http::async_read
  - http::async_read_some

* The overloads of read() and async_read() which take
  just a header have been removed, since they would
  throw away important parse metadata.

* The derived class callbacks for basic_parser have
  been streamlined. All strings passed to callbacks
  are presented in their entirety, instead of being
  provided in pieces.

These changes allow use-cases that were previously
difficult or impossible, such as:

- Efficient relaying

- Late body type commitment

- Expect: 100-continue handling
2017-07-20 08:12:15 -07:00
Vinnie Falco 34830a1780 Rename to BEAST_DOXYGEN
fix #316
2017-07-20 08:12:15 -07:00
Vinnie Falco e7319aade1 Add flat_streambuf:
Objects of this type meet the requirements of DynamicBuffer
and offer an additional invariant: buffer sequences returned
by data() and prepare() are always of length one.
2017-07-20 08:12:15 -07:00
Vinnie Falco 9774ed0e19 Make websocket::close_code a proper enum:
fix #311

This changes close_code to be a proper enumeration.
2017-07-20 08:12:15 -07:00
Vinnie Falco 010a421b3a Set version to 1.0.0-b34 2017-07-20 08:12:15 -07:00
Vinnie Falco 49b3e8f636 Set version to 1.0.0-b33 2017-07-20 08:12:15 -07:00
Vinnie Falco aa24a9c749 Set internal state correctly when writing frames:
fix #300

Correctly set wr_.cont when performing synchronous frame
writes, for the case where masking and autofragment are used.
2017-07-20 08:12:15 -07:00
Vinnie Falco 5bb5f62b9a Require Visual Studio 2015 Update 3 or later
fix #216
2017-07-20 08:12:15 -07:00
Vinnie Falco 7ebddf9c7c Set version to 1.0.0-b32 2017-07-20 08:12:15 -07:00
Vinnie Falco ed906adc35 Remove http Writer suspend and resume feature (API Change):
fix #154

The resume_context parameter passed to instances
of Writer during HTTP serialization is removed.
2017-07-20 08:12:15 -07:00
Vinnie Falco 773285a0e8 Set version to 1.0.0-b31 2017-07-20 08:12:15 -07:00
Florian Behrens 297374b487 Add missing dynabuf_readstream member
fix #277
2017-07-20 08:12:15 -07:00
Vinnie Falco 9f0dc10928 Move the handler, don't copy it 2017-07-20 08:12:15 -07:00
Vinnie Falco 74982213f9 Set version to 1.0.0-b30 2017-07-20 08:12:15 -07:00
Vinnie Falco 0ec9e8c4af Allow concurrent websocket async ping and writes:
fix #271

This modifies the websocket stream implementation's composed
operations to allow caller-initiated asynchronous pings and
frame/message writes to take place at the same time.
2017-07-20 08:12:15 -07:00
Vinnie Falco a22e7056d5 Fix race when write suspends 2017-07-20 08:12:15 -07:00
Vinnie Falco 9554bd105d Fix race in close frames during reads 2017-07-20 08:12:15 -07:00
Vinnie Falco b9b1b53fda Fix race in pings during reads 2017-07-20 08:12:15 -07:00
Vinnie Falco 41c09a45ea Set version to 1.0.0-b29 2017-07-20 08:12:15 -07:00
Vinnie Falco 8fe07212f1 Document type-pun in buffer_cat 2017-07-20 08:12:15 -07:00
Vinnie Falco e224d64949 Fix illegal HTTP characters accepted as hex zero 2017-07-20 08:12:15 -07:00
Vinnie Falco 5e7780bbd9 Fix compilation error in non-template class
fix #267
2017-07-20 08:12:15 -07:00
Vinnie Falco d735aa949e Fix race in writes during reads:
fix #261

This fixes a rare condition when responding to a ping or
close frame where the wr_block_ stream variable is not
correctly set for a short window of time.
2017-07-20 08:12:15 -07:00
Vinnie Falco 4c0f7d9286 Set version to 1.0.0-b28 2017-07-20 08:12:15 -07:00
Vinnie Falco 2b799b6371 Fix HTTP split parse edge case:
fix #257

This fixes a problem when doing split parsing (header then body).
The problem arises when the first buffer passed to the header
parser contains exactly the full header and nothing more. The
symptom is that when parsing the body, the parse will erroneously
be considered complete.
2017-07-20 08:12:15 -07:00
Vinnie Falco dbfb7718fc Restyle async result constructions 2017-07-20 08:12:15 -07:00
Vinnie Falco 5bbbb1fb30 Tidy up some WebSocket javadocs 2017-07-20 08:12:14 -07:00
Vinnie Falco a983bb4fe7 Set version to 1.0.0-b27 2017-07-20 08:12:14 -07:00
Vinnie Falco c468158a09 Update copyright dates 2017-07-20 08:12:14 -07:00
Vinnie Falco 51aa614a10 Tidy up tests and docs:
* Add handler_ptr test and increase coverage
* Add test for prepare_buffer
* Move is_call_possible tests to a .cpp file
* Tidy up docs and declarations
2017-07-20 08:12:14 -07:00
Vinnie Falco 7ef72b6ebc Move basic_streambuf to streambuf.hpp (API Change):
* Also change allocator element type to char
2017-07-20 08:12:14 -07:00
Vinnie Falco 765cb22b48 Invoke callback on pings and pongs (API Change):
fix #248

This additionally invokes the pong callback for received pings, allowing
callers to more efficiently detect when a connection is still lively:

* pong_callback renamed to ping_callback
* Callback signature has an extra `bool` to indicate if the received
  control frame is a ping or pong.
2017-07-20 08:12:14 -07:00
Vinnie Falco a5a6563fe2 Set version to 1.0.0-b26 2017-07-20 08:12:14 -07:00
Vinnie Falco 615e80dacd Tidy up warnings and tests:
* Enable WebSocket frame tests
* Remove read_message_max warning
* Remove permessage-deflate check offer warning
2017-07-20 08:12:14 -07:00
Vinnie Falco dc5b5b818c Set version to 1.0.0-b25 2017-07-20 08:12:14 -07:00
Vinnie Falco e79f923c03 Fix deflate setup bug 2017-07-20 08:12:14 -07:00
Vinnie Falco 47068de6ce Remove unnecessary include
fix #242
2017-07-20 08:12:14 -07:00
Vinnie Falco 8ea120f13f Fix 32-bit arm7 warnings
fix #232
2017-07-20 08:12:14 -07:00
Vinnie Falco d7e9a7ca3c Better handler_ptr (API Change):
fix #242

* Add public constructors
* Add handler_ptr::empty()
* Add handler_ptr::element_type
* Remove make_handler_ptr free function
* Compiler error if element_type is an array type
* handler_ptr::get() returns nullptr if no object is owned
2017-07-20 08:12:14 -07:00
Vinnie Falco bf7864cfc6 Set version to 1.0.0-b24 2017-07-20 08:12:14 -07:00
Vinnie Falco 911617c43f Add permessage-deflate WebSocket extension:
This implements the permessage-deflate WebSocket
extension as described in HyBi Working Group
draft-ietf-hybi-permessage-compression-28:
https://tools.ietf.org/html/draft-ietf-hybi-permessage-compression-28

This extension allows messages to be compressed using
the raw "deflate" algorithm described in RFC 1951,
"DEFLATE Compressed Data Format Specification version 1.3":
https://www.ietf.org/rfc/rfc1951.txt
2017-07-20 08:12:14 -07:00
Vinnie Falco 99706347cd Make decorator copyable 2017-07-20 08:12:14 -07:00
Edward Hennis 1cd8b8c6b4 Set version to 1.0.0-b23 2017-07-20 08:12:14 -07:00
Vinnie Falco 133d926e2f Fix message constructor and special members
fix #196
2017-07-20 08:12:14 -07:00
Vinnie Falco cfde28c3c3 Add file and line number to thrown exceptions 2017-07-20 08:12:14 -07:00
Vinnie Falco 31b8c42111 Set version to 1.0.0-b22 2017-07-20 08:12:14 -07:00
Vinnie Falco 64e0bb15ad Fix websocket stream read documentation 2017-07-20 08:12:14 -07:00
Vinnie Falco ffe2e8e02b Avoid copies in handler_alloc 2017-07-20 08:12:14 -07:00
Vinnie Falco 4ab2b5e5e7 Add handler helpers 2017-07-20 08:12:14 -07:00
Vinnie Falco 01e1fa2dc9 Implement asio dealloc-before-invoke guarantee:
fix #215

This change guarantees that temporary memory allocated
through the asio hooks by the Beast implementation is
deallocated before invoking the final handler when performing
composed operations.

The change is accomplished by replacing std::shared_ptr with
a thread-safe custom container handler_ptr to manage composed
operation state. The container tracks other instances which
manage the same object and resets them in a safe way before
invoking the final handler.

handler_ptr is provided as a public interface so that users of
this library can utilize the same idiom to write their own
composed operations.
2017-07-20 08:12:14 -07:00