Commit Graph

1313 Commits

Author SHA1 Message Date
Vinnie Falco
f7211da154 Refactor treatment of request-method (API Change):
fix #397

method enum class is added to represent all known request methods.
Functions are provided to convert from strings to and from the method
enumeration.

The fields container is modified to also work with the enum.
2017-07-20 08:12:17 -07:00
Vinnie Falco
cd2363e951 Set version to 46 2017-07-20 08:12:17 -07:00
Vinnie Falco
0056c97d94 Documentation work 2017-07-20 08:12:17 -07:00
Vinnie Falco
060f4a007b Refactor serialization algorithms:
serializer interface is changed to be buffer-only, no streams,
and placed in its own header file.

Operations on serializers are moved to free functions as part
of the HTTP write family of synchronous and asynchronous algorithms.
2017-07-20 08:12:17 -07:00
Vinnie Falco
d0d08e81f9 Rename to make_serializer 2017-07-20 08:12:17 -07:00
Vinnie Falco
75b0571e83 Refactor type_traits (API Change):
fix #373

* concepts.hpp is renamed to type_traits.hpp

* Body reader and writer concepts are renamed
2017-07-20 08:12:17 -07:00
Vinnie Falco
3664329ea7 Refactor HTTP serialization (API Change):
A new class `serializer` is introduced to permit incremental
serialization of HTTP messages. Existing free functions are
re-implemented in terms of this new class.

* The BodyReader concept is refined to support a greater variety
of strategies for providing buffers representing the body to
the serialization algorithms.

* Added buffer_body, a new model of Body which allows the caller
to provide a series of owned buffers using their own serialization
loop.

* Added empty_body, a model of Body which is for serialization only,
to represent HTTP messages with no content body.

* Removed overloads of write and async_write which send only
the HTTP header.

* Removed public interfaces for performing low-level chunk encoding.
2017-07-20 08:12:17 -07:00
Vinnie Falco
b9bdb1bbbc Remove HTTP header aliases (API Change):
fix #382

* request_header and response_header are removed
2017-07-20 08:12:17 -07:00
Vinnie Falco
9a6d4f153b Set version to 45 2017-07-20 08:12:17 -07:00
Vinnie Falco
4ed6a7fe21 Disable reverse_iterator buffer_view test 2017-07-20 08:12:17 -07:00
Vinnie Falco
056bf5ff99 buffer_view skips empty buffer sequences 2017-07-20 08:12:17 -07:00
Vinnie Falco
c6cddc83c4 Fix header::reason 2017-07-20 08:12:17 -07:00
Vinnie Falco
f0349efddc Workaround for boost::asio::basic_streambuf type check 2017-07-20 08:12:17 -07:00
Vinnie Falco
e58fce380c Set version to 44 2017-07-20 08:12:17 -07:00
Vinnie Falco
2b18193f7d Make buffers_adapter meet requirements
fix #386
2017-07-20 08:12:17 -07:00
Vinnie Falco
7c47668cbb Tidy up is_dynamic_buffer traits test 2017-07-20 08:12:17 -07:00
Vinnie Falco
600f6da5a3 Fix async return values in docs 2017-07-20 08:12:17 -07:00
Vinnie Falco
24fd5ec8af Use BOOST_STATIC_ASSERT
fix #380
2017-07-20 08:12:17 -07:00
Vinnie Falco
02033c7412 Tidy up and make get_lowest_layer public
fix #379
2017-07-20 08:12:17 -07:00
Vinnie Falco
e86ca5d66b Require Boost 1.58 or later 2017-07-20 08:12:17 -07:00
Vinnie Falco
929174d4d8 Tidy up read_size_helper and dynamic buffers
fix #376
2017-07-20 08:12:17 -07:00
Vinnie Falco
3543b4b913 Use BOOST_THROW_EXCEPTION
fix #370
2017-07-20 08:12:17 -07:00
Vinnie Falco
1c1e0c8ae0 Set version to 43 2017-07-20 08:12:17 -07:00
Vinnie Falco
39697ea37f Additional constructors for consuming_buffers 2017-07-20 08:12:17 -07:00
Vinnie Falco
b76d19c3cb Tidy up buffer_prefix overloads and test 2017-07-20 08:12:17 -07:00
Vinnie Falco
000349ba23 Fix strict aliasing warnings in buffers_view 2017-07-20 08:12:17 -07:00
Vinnie Falco
e6ef8261f6 Set version to 42 2017-07-20 08:12:17 -07:00
Vinnie Falco
9e16e24ec4 Make buffers_view a public interface 2017-07-20 08:12:17 -07:00
Vinnie Falco
4332844d89 Fix javadoc typo 2017-07-20 08:12:17 -07:00
Vinnie Falco
11eaead294 Set version to v41 2017-07-20 08:12:17 -07:00
Vinnie Falco
71e4fbe428 Remove handler helpers, tidy up hook invocations (API Change) 2017-07-20 08:12:17 -07:00
Vinnie Falco
68a0f3af4f Rename prepare_buffer(s) to buffer_prefix (API Change) 2017-07-20 08:12:17 -07:00
Vinnie Falco
83ea2308a2 Tidy up websocket::close_code enum and constructors
fix #359
2017-07-20 08:12:17 -07:00
Vinnie Falco
afde7508f1 Tidy up formal parameter names
fix #361
2017-07-20 08:12:17 -07:00
Vinnie Falco
51f11f0902 Concept revision and documentation (API Change):
The concept type traits are renamed for consistency,
and consolidated into a single header file <beast/core/type_traits.hpp>

A new section, Core Concepts, is added to the documentation describing all
of the core utility classes and functions. This also includes a complete
explanation and sample program describing how to write asynchronous initiation
functions and their associated composed operations.
2017-07-20 08:12:16 -07:00
Vinnie Falco
aa8a0a2a4b Replace asynchronous helper macros with template aliases (API Change) 2017-07-20 08:12:16 -07:00
Vinnie Falco
043386aeb3 Move prepare_buffers to prepare_buffer.hpp (API Change)
fix #338
2017-07-20 08:12:16 -07:00
Vinnie Falco
7d8e40537a Remove placeholders (API Change) 2017-07-20 08:12:16 -07:00
Vinnie Falco
0656c5b1f5 Return http::error::end_of_stream on HTTP read eof (API Change)
fix #350
2017-07-20 08:12:16 -07:00
Vinnie Falco
463d891e5c Set version to 40 2017-07-20 08:12:16 -07:00
Vinnie Falco
761e005fd6 Fix basic_streambuf movable trait 2017-07-20 08:12:16 -07:00
Vinnie Falco
f097f401cb Consolidate get_lowest_layer in type_traits.hpp
fix #347
2017-07-20 08:12:16 -07:00
Vinnie Falco
4edd797611 Add to_static_string:
This function converts integers to their decimal
representation as a static string.

In addition, static_string::resize no longer initializes
characters if the new size is larger.
2017-07-20 08:12:16 -07:00
Vinnie Falco
8a49eed947 Set version to 39 2017-07-20 08:12:16 -07:00
Vinnie Falco
140bf5cb1d ostream workaround for gcc 4.8.4 2017-07-20 08:12:16 -07:00
Vinnie Falco
5c9e6c0fc0 Increase ostream test coverage 2017-07-20 08:12:16 -07:00
Vinnie Falco
4461f5153c Tidy up HTTP reason_string (API Change):
fix #182

reason_string() is now located in <beast/http/message.hpp>
and returns a string view rather than char const*.
2017-07-20 08:12:16 -07:00
Vinnie Falco
d9562ff525 Harmonize concepts and identifiers with net-ts (API Change):
fix #321

This synchronizes identifier names and some implementation details
with the Networking-TS document and reference implementation.
The following interfaces have changed:

* async_completion
* is_buffer_sequence (removed)
* is_const_buffer_sequence (was is_ConstBufferSequence)
* is_dynamic_buffer (was is_DynamicBuffer)
* is_mutable_buffer_sequence (was is_MutableBufferSequence)
* async_result (new)
* BEAST_HANDLER_TYPE macro (new)
* BEAST_INITFN_RESULT_TYPE macro (new)

Filename changes:

* async_result.hpp (was async_completion.hpp)
2017-07-20 08:12:16 -07:00
Vinnie Falco
46097c7dab Tidy up basic_parser javadocs 2017-07-20 08:12:16 -07:00
Vinnie Falco
84ece031f2 Use beast::string_view alias 2017-07-20 08:12:16 -07:00
Vinnie Falco
fc0e356149 Rename to buffered_read_stream (API Change):
dynabuf_readstream is renamed to buffered_read_stream.
2017-07-20 08:12:16 -07:00
Vinnie Falco
aa9f42cd06 Rename to static_buffer, static_buffer_n (API Change):
These classes are renamed:

* static_streambuf to static_buffer
* static_streambuf_n to static_buffer_n
2017-07-20 08:12:16 -07:00
Vinnie Falco
6e47e9a0ac Rename to flat_buffer, basic_flat_buffer (API Change):
These classes are renamed:

* flat_streambuf to flat_buffer
* basic_flat_streambuf to basic_flat_buffer
2017-07-20 08:12:16 -07:00
Vinnie Falco
24fd254690 Rename to multi_buffer, basic_multi_buffer (API Change):
These classes are renamed:

* streambuf to multi_buffer
* basic_streambuf to basic_multi_buffer
2017-07-20 08:12:16 -07:00
Vinnie Falco
38b473902a New buffers() replaces to_string() (API Change):
A new function, buffers(), returns an implementation defined object
which wraps a ConstBufferSequence and supports formatting to a
std::ostream.

The function to_string is removed, as the new implementation allows
conversion to string using boost::lexical_cast on the return value
of the call to buffers(). Streaming to an output stream is more
efficient: no dynamic allocations are performed.

Example:

    streambuf sb;
    std::cout << buffers(sb.data()) << std::endl;
2017-07-20 08:12:16 -07:00
Vinnie Falco
3add5f293c New ostream() returns dynamic buffer output stream (API Change):
This eliminates beast::write output for dynamic buffers and replaces
it with the function ostream() that wraps a caller provided dynamic
buffer and returns the result as a std::ostream derived object.
Callers may now produce formatted output into any object meeting the
requirements of DynamicBuffer using operator<< and the standard stream
modifiers such as std::endl.

This new technique is more efficient, as implementations of operator<<
can now write directly into the output using std::ostream::write and
std::ostream::put.

Example of use:

  beast::streambuf sb;
  beast::ostream(sb) << "Hello, world!" << std::endl;
2017-07-20 08:12:16 -07:00
Vinnie Falco
3f58d81fc4 Fix eof error on ssl::stream shutdown
fix #334
2017-07-20 08:12:16 -07:00
Vinnie Falco
a52914175b Refactor http::header contents (API Change):
fix #124

The http::header data members "method", "url", and "reason"
are changed from data members, to pairs of get and set
functions which forward the call to the Fields type used
to instantiate the template.

Previously, these data members were implemented using
std::string. With this change, the implementation of the
Fields type used to instantiate the template is now in
control of the representation of those values. This permits
custom memory allocation strategies including uniform use of
the Allocator type already provided to beast::http::basic_fields.
2017-07-20 08:12:16 -07:00
Vinnie Falco
02d4086061 Set version to 1.0.0-b38 2017-07-20 08:12:16 -07:00
Vinnie Falco
1a1a1d508b Prevent basic_fields operator[] assignment
fix #258
2017-07-20 08:12:16 -07:00
Vinnie Falco
f7a0885d17 Remove websocket::keep_alive option (API Change):
fix #332

This removes the keep_alive option from the WebSocket stream.
Callers who wish to control the behavior of the Connection
header may do so in the decorator and completion handlers
for the handshake and accept functions.
2017-07-20 08:12:16 -07:00
Vinnie Falco
3da0d8b6a9 Refactor WebSocket error codes (API Change):
fix #325

This removes unused and misleading handshake error codes.
All semantic handshake failures are now reported using
the same code, error::handshake_failed. Errors originating
from stream operations still use the underlying stream
error codes (for example: boost::asio::error::connection_reset).
2017-07-20 08:12:16 -07:00
Vinnie Falco
707f5c867e Use static_string for WebSocket handshakes:
fix #328

This replaces usages of std::string with
static_string when performing WebSocket handshakes.
2017-07-20 08:12:16 -07:00
Vinnie Falco
c5184bed47 Refactor base64:
The implementation no longer uses std::string
and instead works on raw memory buffers, which
must be pre-sized accordingly.
2017-07-20 08:12:16 -07:00
Vinnie Falco
040323305e Refactor static_string:
static_string interface now closely matches std::basic_string.
2017-07-20 08:12:16 -07:00
Vinnie Falco
360fe691c5 Set version to 1.0.0-b37 2017-07-20 08:12:16 -07:00
Vinnie Falco
43cf3ae1f8 Fix narrowing warning in table constants
fix #344
2017-07-20 08:12:16 -07:00
Vinnie Falco
df81d509d5 Fix flat_streambuf:
Don't call memcpy or memmove with null arguments.
2017-07-20 08:12:15 -07:00
Vinnie Falco
e4a204b145 Rename to http::dynamic_body, consolidate header:
fix #284

* streambuf_body is renamed to dynamic_body
* basic_dynabuf_body is renamed to basic_dynamic_body
2017-07-20 08:12:15 -07:00
Vinnie Falco
28a994e8cb Move everything in basic_fields.hpp to fields.hpp (API Change)
fix #320
2017-07-20 08:12:15 -07:00
Vinnie Falco
4b19600dd2 Rename to detail::is_invocable
Fix #323
2017-07-20 08:12:15 -07:00
Vinnie Falco
512ab5ba7d Rename to websocket::detail::pausation
Fix #324
2017-07-20 08:12:15 -07:00
Vinnie Falco
4b02fe989f Document websocket::stream thread safety
fix #329
2017-07-20 08:12:15 -07:00
Vinnie Falco
4b3a21efec Add is_upgrade() free function:
fix #195

This function returns `true` when the passed HTTP Request
indicates a WebSocket Upgrade. It does not validate the
contents of the fields: it just trivially accepts requests
which can only be a WebSocket Upgrade message.

Callers who wish to manually read HTTP requests in their
server implementation can use this function to determine if
the request should be routed to an instance of websocket::stream.
2017-07-20 08:12:15 -07:00
Vinnie Falco
fa1f4c7d56 Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317

websocket::stream now provides the following families of
functions for performing handshakes:

When operating in the server role:

    * stream::accept
    * stream::accept_ex
    * stream::async_accept
    * stream::async_accept_ex

When operating in the client role:

    * stream::handshake
    * stream::handshake_ex
    * stream::async_handshake
    * stream::async_handshake_ex

Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).

The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.

The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.

The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.

The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-07-20 08:12:15 -07:00
Vinnie Falco
fab1015b89 Provide websocket::stream accept() overloads (API Change):
This adds enough functions to the accept and async_accept
overload set to cover all combinations of request, buffers,
and error_code parameters. This also fixes a defect where
providing a complete Upgrade request when there are additional
unprocessed octets remaining in the callers stream buffer
could not be furnished to the WebSocket implementation.
2017-07-20 08:12:15 -07:00
Vinnie Falco
ad22f60666 Set version to 1.0.0-b36 2017-07-20 08:12:15 -07:00
Vinnie Falco
26440a90b7 Set version to 1.0.0-b35 2017-07-20 08:12:15 -07:00
Vinnie Falco
44714e3f04 Tidy up doc declarations 2017-07-20 08:12:15 -07:00
Vinnie Falco
19b75e5048 Remove http::empty_body (API Change) 2017-07-20 08:12:15 -07:00
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
Vinnie Falco
1a26484eca Add missing include 2017-07-20 08:12:14 -07:00
Vinnie Falco
f70ac4cb86 Fix broken Intellisense (MSVC)
Fix #213
2017-07-20 08:12:14 -07:00
Vinnie Falco
a5d063d5b9 Set version to 1.0.0-b21 2017-07-20 08:12:14 -07:00
Vinnie Falco
f8590a31a9 Remove extraneous includes
fix #207
2017-07-20 08:12:14 -07:00
Vinnie Falco
51ee01ed95 Set version to 1.0.0-b20 2017-07-20 08:12:14 -07:00
Miguel Portilla
c49bee78db Increase utf8 checker code coverage 2017-07-20 08:12:14 -07:00
Vinnie Falco
5089cf59ee Add zlib module:
The zlib module is a port of ZLib's raw deflate
algorithm to header-only C++11.
2017-07-20 08:12:14 -07:00
Vinnie Falco
e3848e7281 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.
2017-07-20 08:12:13 -07:00
Vinnie Falco
879262abb1 Set version to 1.0.0-b19 2017-07-20 08:12:13 -07:00
Vinnie Falco
77bdb43843 Tidy up internal name 2017-07-20 08:12:13 -07:00
Vinnie Falco
be67224390 Better buffer_cat:
buffer_cat now determines if all of the buffer sequences in
the list of passed buffer sequences each have value types which
are convertible to mutable_buffer. The returned concatenated
sequence will be a MutableBufferSequence if all the passed
buffer sequences meet the requirements of MutableBufferSequence,
else the returned concatenated sequence will be a ConstBufferSequence.
2017-07-20 08:12:13 -07:00
Vinnie Falco
6afa6afc98 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.
2017-07-20 08:12:13 -07:00
Vinnie Falco
8f535ba74f prepared_buffers is private (API Change) 2017-07-20 08:12:13 -07:00
Vinnie Falco
08d8a2ae35 Fix prepare_buffers value_type:
This fixes a bug where calling prepare_buffers on a buffer
sequence whose value_type is not const_buffer or mutable_buffer
causes compilation errors.

The documentation is also tidied up.
2017-07-20 08:12:13 -07:00
Vinnie Falco
aa8e7432c2 Use boost::lexical_cast instead of std::to_string
fix #176
2017-07-20 08:12:13 -07:00
Vinnie Falco
2a50915322 Fix with_body example:
fix #177
2017-07-20 08:12:13 -07:00
Vinnie Falco
5b041193f2 Increase code coverage 2017-07-20 08:12:13 -07:00
Vinnie Falco
6d2195514d Boost library min/max guidance:
fix #170
2017-07-20 08:12:13 -07:00
Vinnie Falco
1eb673dd7d Add read, async_read for message_headers:
fix #172, fix #173

This provides overloads of read and async_read to allow
reading message_headers objects.
2017-07-20 08:12:13 -07:00
Vinnie Falco
8035dac88c Add write, async_write, operator<< for message_headers:
fix #155

This adds overloads of write, async_write, and operator<<
for message_headers.
2017-07-20 08:12:13 -07:00
Vinnie Falco
f98ec17121 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.
2017-07-20 08:12:13 -07:00
Vinnie Falco
50bc9a58cd 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.
2017-07-20 08:12:13 -07:00
Vinnie Falco
595c5e0b6b Move sync_ostream to core/detail 2017-07-20 08:12:13 -07:00
Vinnie Falco
312bd6b21d Optimize mask operations 2017-07-20 08:12:13 -07:00
Miguel Portilla
d91fbd0611 Optimize utf8 validation 2017-07-20 08:12:13 -07:00
Vinnie Falco
804038095c Set version to 1.0.0-b18 2017-07-20 08:12:13 -07:00
Vinnie Falco
f904759877 Add websocket::stream pong and async_pong 2017-07-20 08:12:13 -07:00
Vinnie Falco
f56d4fe74b Close connection during async_read on close frame:
fix #163
2017-07-20 08:12:13 -07:00
Vinnie Falco
a2ea4f38c1 Move clamp to core 2017-07-20 08:12:13 -07:00
Vinnie Falco
a878165e36 Fix write_frame masking and auto-fragment handling 2017-07-20 08:12:13 -07:00
Vinnie Falco
dfb2d05be3 Write buffer option does not change capacity 2017-07-20 08:12:13 -07:00
Vinnie Falco
74e77682c7 Meet DynamicBuffer requirements for static_streambuf 2017-07-20 08:12:13 -07:00
Vinnie Falco
4e25e0f99e Reorganize source files and definitions 2017-07-20 08:12:13 -07:00
Vinnie Falco
1a53f52e34 Check invariants in parse_op:
This adds more assertions, comments, and clarification.
2017-07-20 08:12:13 -07:00
Vinnie Falco
8f6e238ab9 Clean up message docs 2017-07-20 08:12:13 -07:00
Vinnie Falco
0e1be4d2cb Set version to 1.0.0-b17 2017-07-20 08:12:13 -07:00
Vinnie Falco
48674cd482 Trim unused code 2017-07-20 08:12:13 -07:00
Vinnie Falco
4f68ec7b7b Doc fixes 2017-07-20 08:12:13 -07:00
Andrew Whatson
ed23fd5811 Fix unused parameter warnings and missing includes:
fix #127

* Added beast::detail::ignore_unused based on boost::ignore_unused
* Added -Wextra compilation flag when building with gcc
* Fixed all unused parameter warnings with ignore_unused
* Fixed all missing includes when building each .hpp separately
2017-07-20 08:12:13 -07:00
Miguel Portilla
0a1c24eb9f Refactor read_size_helper 2017-07-20 08:12:13 -07:00
Vinnie Falco
ae58a7f457 Engaged invokable is destructible:
fix #147
2017-07-20 08:12:13 -07:00
Vinnie Falco
f3b22f74b2 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.
2017-07-20 08:12:13 -07:00
Vinnie Falco
4ded6cff76 Fix handling of body_what::pause in basic_parser_v1 2017-07-20 08:12:13 -07:00
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
Vinnie Falco
8b71afa63f Remove extraneous header file status.hpp 2017-07-20 08:12:07 -07:00
Vinnie Falco
2b212e8844 Add usage example to rfc7230 javadocs 2017-07-20 08:12:07 -07:00
Vinnie Falco
19f15046b0 Fixes and documentation for teardown and use with SSL:
This solves a problem where clang and gcc locate the deleted
version of teardown and async_teardown instead of the overloaded
version. It requires overloads to add `teardown_tag` into the signature
so that the rules for argument dependent lookup can find the
right function. Improve documentation of teardown requirements

The documentation is updated to clearly explain the need for including
<beast/websocket/ssl.hpp> to use SSL streams with WebSocket.

The default implementations of teardown and async_teardown now use
static_assert to alert the user of improper usage, with comments
providing guidance for resolving the error.
2017-07-20 08:12:07 -07:00
Vinnie Falco
64206b5612 Qualify some calls:
This fixes a problem where a call to read() is ambiguous because
the argument list contains objects from both boost::asio and
beast::http.

Users invoking read may need to do so fully qualified, by writing:
    beast::http::read(...);
2017-07-20 08:12:07 -07:00
Vinnie Falco
62219add69 Initialize Writer in prepare:
Writer requires a call to Writer::init to call content_length. This
changes prepare to correctly call init. A consequences is that
prepare can now throw unexpectedly for user-defined writers that
can fail their initialization.
2017-07-20 08:12:07 -07:00
Vinnie Falco
227c2b131d Set Beast version to 1.0.0-b6 2017-07-20 08:12:07 -07:00
Vinnie Falco
589e18c199 rfc7230 compliance, limits, and tests for basic_parser_v1:
New parser set_option function for controlling independent size limits
on headers and body. By default request and response parsers are set up
with reasonable limits to prevent resource exhaustion attacks.

* Parser adheres strictly to rfc7230
* Increased test coverage
* Headers and body maximum size limit options
2017-07-20 08:12:07 -07:00
Vinnie Falco
6c30ee1a98 Rename concept to DynamicBuffer (API change):
Conform to the Networking TS by renaming the Streambuf concept
to DynamicBuffer in all places. Values of types meeting the
requirements of DynamicBuffer are renamed to dynabuf.

See:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4478.html#requirements.dynamic_buffers

* Headers renamed
* Formal parameter names renamed
* Template argument types renamed
* Documentation updated
2017-07-20 08:12:07 -07:00
Vinnie Falco
e8019fa9d4 Add message swap members and free functions 2017-07-20 08:12:07 -07:00
Vinnie Falco
db68ce4d97 Add HTTP field value parsers:
ext_list:
    Iterable container of comma separated extensions, where each extension
    is a token followed an optional list of semicolon delimited parameters,
    with each parameter consisting of a name / value pair. The value can
    be a token or quoted-string.

param_list:
    Iterable container of semicolon delimited parameters, where each parameter
    is a name / value pair. The value can be a token or quoted-string.

token_list
    Iterable container of comma delimited tokens.

* Remove obsolete rfc2616 functions

* Refactor and consolidate case-insensitive string helpers
2017-07-20 08:12:07 -07:00
Vinnie Falco
8743a7a399 Tidy up use of GENERATING_DOCS 2017-07-20 08:12:07 -07:00
Vinnie Falco
3406729a8d Use beast::error_code instead of nested types 2017-07-20 08:12:07 -07:00
Vinnie Falco
8686b28cf2 Use SFINAE on return values 2017-07-20 08:12:07 -07:00
Vinnie Falco
b90aae26ab Set Beast version to 1.0.0-b5 2017-07-20 08:12:07 -07:00
Vinnie Falco
19256b85f0 HTTP improvements:
* Increased code coverage

* New Body concepts:
    is_Body
    is_ReadableBody
    is_WritableBody
2017-07-20 08:12:07 -07:00
Vinnie Falco
039244cda4 WebSocket ping, fixes, coverage:
* Improve test coverage
* tests for invokable in composed ops

* Update documentation
* Add License badge to README
* Target Windows 7 SDK and later
* Make role_type private
* Remove extra unused masking functions
* Allow stream reuse / reconnect after failure
* Restructure logic of composed operations
* Allow 0 for read_message_max meaning no limit
* Respect keep alive when building HTTP responses
* Check version in upgrade request
* Response with 426 status on unsupported WebSocket version
* Remove unnecessary Sec-WebSocket-Key in HTTP responses
* Rename to mask_buffer_size

* Remove maybe_throw
* Add ping, async_ping, async_on_pong
* Add ping_op
* Add pong_op
* Fix crash in accept_op
* Fix suspend in close_op
* Fix read_frame_op logic
* Fix crash in read_op
* Fix races in echo sync and async echo servers
2017-07-20 08:12:07 -07:00
Vinnie Falco
bfb840fe8e Fix parser off by one accessing buffer bug:
This fixed a bug where in some cases the parser could dereference
past the end of the caller provided buffer. The unit test is
improved to allocate memory in separate pieces for the split-buffer
matrix test, to give address-sanitizer more to work with.
2017-07-20 08:12:07 -07:00
Vinnie Falco
0d69868051 Fix resume of invokables in websocket composed operations:
When a suspended composed operation is resumed, the operation
now posts to the io_service to get in the correct context. Previously,
invokables resumed in the context of a different completion handler.

* asio_handler_invoke for any resumed invokable will return `true`.
2017-07-20 08:12:07 -07:00
Vinnie Falco
908794bab2 Add dstream 2017-07-20 08:12:07 -07:00
Vinnie Falco
82f1661a47 Set Beast version to 1.0.0-b4 2017-07-20 08:12:07 -07:00
seelabs
da78f3cec4 Tidying and fix warnings 2017-07-20 08:12:07 -07:00
Vinnie Falco
4f1b9089b8 Parser concept, fixes:
A new concept Parser is introduced with routines to read from a stream
into the parser. This solves a problem with the old read interface where
messages must be default constructible and move assignable.

Parser fixes:

* Fix detect invalid reason-phrase octets
* Fix write_eof to set the 'complete' state on success
* Fix consider parse complete if eof received on empty body

WebSocket:

* Increase coverage
2017-07-20 08:12:06 -07:00
Vinnie Falco
b62d1b2164 Fixes, fail testing:
Core:

* Test buffer_cat iterator move members

HTTP:

* Fixed yield / resume in writer
* Fixed message serialization with chunked encoding

* Test yield / resume in writer
* Test all conditional branches during message serialization
* Test chunked encoding
* Increase coverage on parse_error
* Add parse_error::general

WebSocket:

* Add error::general
* Increase coverage in error
2017-07-20 08:12:06 -07:00
Vinnie Falco
c49cde844b New constructors for message:
The message class now behaves like a pair with respect to the construction
of the body and headers. Additional constructors allow construction of
just the body portion from a tuple, leaving the headers default
constructed.

Previous constructors are removed as they were a notational convenience
for assembling HTTP/1 requests and responses. They are not necessary
as this library aims at library writers and not end users.
2017-07-20 08:12:06 -07:00
Vinnie Falco
3484996048 Tidy up core sources:
The core headers are moved to their own directory (but remain in
the same namespace).
2017-07-20 08:12:06 -07:00
Vinnie Falco
a59329ff8e Improvements to code coverage:
More tests and test cases are added to bring up
the percentage of library code covered by tests.
2017-07-20 08:12:06 -07:00
seelabs
427c35f5e1 Fix invalid access after async initiation 2017-07-20 08:12:06 -07:00
Vinnie Falco
b14434456c Refactor extras:
A new directory extras/ is added, and code not part of the official
public Beast interface is moved there.
2017-07-20 08:12:06 -07:00
Vinnie Falco
133e7a3b16 Improvements to increase code coverage:
* Don't include the test code in coverage reports
* Add test code for missing coverage

Other:

* Improve the README.md
* Fix warning in sha1_context
* Tidy up the examples use of namespaces
* Various fixes to documentation and javadocs
2017-07-20 08:12:06 -07:00
Vinnie Falco
4bbf393e38 Tidy up declarations and files:
* Adjust formatting
* Fix inline namespace warning in main.cpp
* Fix streambuf op ambiguous variadic constructor
* Rename variables for clarity
2017-07-20 08:12:06 -07:00
Vinnie Falco
96e1e53cdd Don't perform an extra clear 2017-07-20 08:12:06 -07:00
Vinnie Falco
79913e6759 Fix SHA1 calculation 2017-07-20 08:12:06 -07:00
Vinnie Falco
63aef56942 Set Beast version to 1.0.0-b3 2017-07-20 08:12:06 -07:00
Vinnie Falco
313620ce7e Tidy up tests, build scripts, and documentation:
* Concepts split up into individual files
* Function definitions moved to .ipp files
* Add more tests to fill gaps in coverage
* Fix documentation Xsl
2017-07-20 08:12:06 -07:00
Vinnie Falco
c309f53ed2 Distinguish HTTP/1 messages from general HTTP messages:
The version field is moved into message_v1, all public interfaces
are reworked to identify HTTP/1 wire format operations (suffix "_v1")
versus general HTTP.
2017-07-20 08:12:05 -07:00
seelabs
e552ba7c2d Fix invokable order of invocation:
The call to the final handler in a composed operation MUST be
the last thing performed, as the handler may cause the end of
object lifetimes before it returns.
2017-07-20 08:12:05 -07:00
Vinnie Falco
4104eca1f1 WebSocket refactoring and tests:
websocket:

* Move echo server to test/
* Fix warnings
* Fix maskgen being uncopyable
* Simplify utf8_checker special member declarations
* Fix stream move assignable when owning the next layer
* Add javadocs for stream special members
* Add stream unit tests
* Move throwing member definitions to the .ipp file
* Use get_lowest_layer in stream declaration
* Perform type checks at each call site instead of constructor
* Demote close_code to a non-class enum:
    Otherwise, application specific close codes
    cannot be assigned without using static_cast.

core:

* Add streambuf_readstream special members tests
* Add move assignment operator to streambuf_readstream
* Add detail/get_lowest_layer trait
* Add static_string tests
* Move static_string from websocket to core
2017-07-20 08:12:05 -07:00
Vinnie Falco
a0b04bdff2 Refactor beast core, http, tests, and examples:
* Fix warnings
* Port cmake scripts to linux
* Add command line options for running test suites
* Add examples to CMakeLists
* Return std::uint64_t from writer::content_length
* basic_parser::write takes asio::const_buffer instead of pointer and size
* Turn message test back on now that it passes
* Rename to http::headers, use std::allocator, remove http_headers
* http::message::method is now a string
* Refactor to_string for ConstBufferSequence
* Remove chunk_encode from the public interface
* Initialize members for default constructed iterators
* Disallow default construction for dependent buffer sequences

Refactor http::message serialization:

* Serialization no longer creates a copy of the
  headers and modifies them
* New function prepare(), sets Connection, Transfer-Encoding,
  Content-Length based on the body attributes and caller options.
  Callers can use prepare() to have the fields set automatically,
  or they can set the fields manually.
* Use write for operator<<
* Tests for serialization
2017-07-20 08:12:05 -07:00
seelabs
43a81ff1a7 Fix destruction of basic_headers elements:
* Add missing call to destroy
* Use traits to destroy the element
2017-07-20 08:12:05 -07:00
Vinnie Falco
9a3a42a644 Truncate history, version 1.0.0-b2 2017-07-20 08:01:46 -07:00