Commit Graph

78 Commits

Author SHA1 Message Date
Vinnie Falco f47b66179e 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-05-04 18:58:33 -07:00
Vinnie Falco f6835b8db4 Rename to BEAST_DOXYGEN
fix #316
2017-05-04 18:58:33 -07:00
Vinnie Falco 7e37723be0 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-05-04 18:58:33 -07:00
Brad Chase 5b68faa100 Doc XSL support for list and table markdown 2017-04-23 08:26:20 -07:00
Vinnie Falco b893749e29 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-04-10 15:54:29 -07:00
Vinnie Falco faed9e57f2 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-02-27 10:50:32 -05:00
Florian Behrens f0399b68c0 Fix doc link typo 2017-02-24 13:24:54 -05:00
Steve Brain 4fa0bf645b Fix Writer return value documentation 2017-02-24 13:24:49 -05:00
Vinnie Falco e64ca2fa33 Fix Body requirements doc 2017-02-22 18:15:48 -05:00
Vinnie Falco a6120cd8be Update copyright dates 2017-02-07 15:20:25 -05:00
wilsonianb c7bfe7df4a Add documentation building instructions 2017-02-07 15:18:42 -05:00
Vinnie Falco f6c91ce9f5 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-02-06 11:34:29 -05:00
Vinnie Falco b8639a791a 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-02-05 18:45:22 -05:00
Vinnie Falco 439a224e1d WebSocket server examples and test tidying:
fix #238, fix #165

* Tidy up WebSocket echo servers
* Add WebSocket echo servers to examples
2017-02-01 20:05:39 -05:00
Vinnie Falco 0474cc5df2 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-02-01 20:05:38 -05:00
Vinnie Falco a4509684cc 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-01-27 19:46:49 -05:00
Denis Andrejew 2eb4b0c6cd Fix code sample in websocket.qbk 2017-01-08 10:15:20 -05:00
Denis Andrejew 58802f4d6d Fix typos in design.qbk 2017-01-08 10:15:19 -05:00
Vinnie Falco 19dc4bb628 Update documentation examples
fix #222
2017-01-08 07:23:58 -05:00
Vinnie Falco 114175cd1f 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-01-07 16:07:01 -05:00
Vinnie Falco 9ff1a27160 Add zlib module:
The zlib module is a port of ZLib's raw deflate
algorithm to header-only C++11.
2016-11-15 12:04:59 -05:00
Vinnie Falco a0a335972f Refactor HTTP identifier names (API Change):
fix #171

Several names and  HTTP identifiers are renamed to be
more consistent, self-explanatory, and concise:

* "Fields" is a collection of HTTP header fields (rfc7230 section 3.2)
* "Header" is the Start Line plus Fields. Another way to look at it is,
  the HTTP message minus the body.
* `basic_fields` replaces `basic_headers`
* `fields` replaces `headers`
* `Fields` replaces `Headers` in template parameter lists
* `header` replaces `message_headers`
* `header::fields` replaces `message_headers::fields`

The changes are cosmetic and do not affect run-time behavior.
2016-11-15 12:04:44 -05:00
Vinnie Falco f94f21db0b Fix consuming_buffers value_type (API Change):
This fixes a bug where instantiations of consuming_buffers with
buffer sequence types whose value_type is not const_buffer or
mutable_buffer can cause compilation errors.

The function consumed_buffers is removed.
2016-11-12 11:27:59 -05:00
Vinnie Falco 2c524b41ab prepared_buffers is private (API Change) 2016-11-12 11:27:58 -05:00
Vinnie Falco f22458539b Add write, async_write, operator<< for message_headers:
fix #155

This adds overloads of write, async_write, and operator<<
for message_headers.
2016-11-12 11:27:55 -05:00
Vinnie Falco ea48bcf4e6 Make chunk_encode public:
fix #154, fix #156

This adds public interfaces for transforming buffer
sequences into their chunk-encoded equivalents. The
transformations are O(1) in space and time.
2016-11-12 11:27:55 -05:00
Vinnie Falco f6dd744fd1 Refactor message and message_headers declarations:
message_headers is now a set of partial class template
specializations instead of a template class alias. This solves
a problem where template functions taking message_headers as a
parameter could not deduce argument types, since std::conditional
obscured the deduced context.

Both classes are refactored to share declarations using an #ifdef,
to eliminate an ugly set of extra declarations needed when building
the documentation.

Copy and move class special members are added.

A new function message::base() is provided which returns the
message_headers portion of a message.
2016-11-12 11:27:55 -05:00
Vinnie Falco feb520414c Add websocket::stream pong and async_pong 2016-11-03 18:58:31 -04:00
Vinnie Falco d4ffde5982 Close connection during async_read on close frame:
fix #163
2016-11-01 09:01:02 -04:00
Vinnie Falco 796b484bab Doc fixes 2016-10-20 17:22:41 -04:00
Vinnie Falco d107ba1c1d Add headers_parser:
This allows just the HTTP headers to be parsed, and
the choice of body to be deferred to a subsequent
call to parse.
2016-10-20 17:22:39 -04:00
Vinnie Falco df8d306909 Tidy up documentation:
fix #135

* Fix broken references
* Move doc debug headers to extras/
* Add rfc7230 utility classes to quick reference
2016-10-20 17:22:37 -04:00
Vinnie Falco ada1f60e3e Refine message class hierarchy:
Two new objects, request_headers and response_headers,
represent the portion of HTTP messages excluding the body.
2016-10-20 17:22:36 -04:00
Vinnie Falco cf43f516d2 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
2016-10-17 11:11:57 -04:00
Vinnie Falco 8a261ca923 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
2016-10-17 11:11:57 -04:00
Vinnie Falco 6b4fb28cee Fix Writer exemplar in docs 2016-10-14 15:03:58 -04:00
Vinnie Falco 4224a3a2db Relax ForwardIterator requirements in FieldSequence 2016-10-14 15:03:58 -04:00
Vinnie Falco d81234435f Add pause option to on_headers interface:
* on_headers returns enum body_what
* body_what::pause lets caller receive headers during the parse
2016-10-14 14:12:42 -04:00
Vinnie Falco 2765a67594 Refine Parser concept:
* Parser is not HTTP-specific
* parse algorithms are in their own header
* Update documentation
2016-10-14 14:12:41 -04:00
Vinnie Falco 55c4c9361a Put back missing Design section in docs 2016-10-14 14:08:58 -04:00
Vinnie Falco 90cec54524 Make auto_fragment a boolean option 2016-10-14 14:08:57 -04:00
Vinnie Falco 03642fb585 Rename to write_buffer_size 2016-10-14 14:08:57 -04:00
Vinnie Falco 60e637bd69 Tidy up error types:
* Restructure header material
* Clean up namespace type injections
* Remove extraneous 'success' constants
2016-10-08 01:30:10 -04:00
Vinnie Falco 707fb5eb83 Fix doc reference section 2016-10-08 01:30:10 -04:00
Vinnie Falco 38af0f73d8 Fix message_v1 constructor 2016-10-08 01:30:10 -04:00
Vinnie Falco 027c4e8812 Add Secure WebSocket example 2016-10-08 01:30:10 -04:00
Vinnie Falco 5baaa49aee Add HTTPS example 2016-10-08 01:30:10 -04:00
Vinnie Falco a09a044df0 Use bin/sh 2016-10-08 01:30:10 -04:00
Vinnie Falco 1ff192db02 Update README.md for CppCon 2016 presentation 2016-10-07 23:30:01 -04:00
Vinnie Falco b4a8342795 Update and tidy documentation 2016-09-29 13:03:36 -04:00