Commit Graph
299 Commits
Author SHA1 Message Date
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 434d4d0a55 Add -funsigned-char to asan build target 2017-07-20 08:12:16 -07:00
Vinnie Falco 7d7a360666 Add ub sanitizer blacklist 2017-07-20 08:12:15 -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
Brad Anderson 20c1ba78f1 Fix typo in documentation example 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 52028b8da1 Rename project to http-bench
fix #285
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 8ba166a221 CMake hide command lines in .vcxproj Output windows 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 656017e36d Update README.md 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 7407e3adc3 Fix README.md CMake instructions
fix #318
2017-07-20 08:12:15 -07:00
Vinnie Falco 492391f749 Update .gitignore for VS2017 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
Brad Chase 4d76089241 Doc XSL support for list and table markdown 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 bd4ad15856 Tidy up MSVC CMake configuration 2017-07-20 08:12:15 -07:00
Vinnie Falco 75b8e30a15 Add appveyor build script
Fix #75
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 63ee5048c7 Fix and tidy up CMake build scripts:
This cleans up the Boost CMake configuration and
also fixes a bug in MSVC builds with mismatched
static versus dynamic runtime linkage.
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 6ec2e10c77 Add write_frames unit test 2017-07-20 08:12:15 -07:00
Vinnie Falco f8b0c22501 Add decorator unit test
fix #302
2017-07-20 08:12:15 -07:00
Vinnie Falco a595c3ba85 Use fwrite return value in file_body 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
Sergey Lyubimov 3641521af7 Update CMake scripts for finding packages:
These changes require CMake version 3.7.2 or later.
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 36027ba844 Add io_service completion invariants tests
fix #290
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
Vinnie Falco c5833e279c Fix badge markdown in README.md 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 71db14bad4 Tidy up build settings 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