Commit Graph
1085 Commits
Author SHA1 Message Date
Vinnie Falco 32dbfb283b 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-05-07 13:39:40 -07:00
Vinnie Falco dd6b5004ac WebSocket doc work 2017-05-07 13:39:40 -07:00
Vinnie Falco 0b4d87ccf9 More flat_streambuf tests 2017-05-07 13:39:40 -07:00
Vinnie Falco aacefb4c84 Add test_allocator to extras/test 2017-05-07 13:39:40 -07:00
Vinnie Falco 931a5fb805 Simplify get_lowest_layer test 2017-05-07 13:39:40 -07:00
Vinnie Falco ba4228a832 Use static_string for WebSocket handshakes:
fix #328

This replaces usages of std::string with
static_string when performing WebSocket handshakes.
2017-05-07 13:39:40 -07:00
Vinnie Falco 6df3ff3f0f Refactor base64:
The implementation no longer uses std::string
and instead works on raw memory buffers, which
must be pre-sized accordingly.
2017-05-07 13:39:39 -07:00
Vinnie Falco 19b124dbd3 Refactor static_string:
static_string interface now closely matches std::basic_string.
2017-05-07 13:39:39 -07:00
Vinnie Falco 30e8d160a0 Set version to 1.0.0-b37 2017-05-07 13:20:18 -07:00
Vinnie Falco b14102092d Fix narrowing warning in table constants
fix #344
2017-05-07 13:18:41 -07:00
Vinnie Falco d554b81b06 Add -funsigned-char to asan build target 2017-05-07 11:13:51 -07:00
Vinnie Falco bcc6ad8e5e Add ub sanitizer blacklist 2017-05-07 09:33:52 -07:00
Vinnie Falco e1f08e9aa1 Fix flat_streambuf:
Don't call memcpy or memmove with null arguments.
2017-05-07 07:20:13 -07:00
Brad Anderson 7d08f59fa6 Fix typo in documentation example 2017-05-05 21:00:56 -07:00
Vinnie Falco 21ef97d220 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-05-05 21:00:56 -07:00
Vinnie Falco 45a2d73993 Rename project to http-bench
fix #285
2017-05-05 21:00:56 -07:00
Vinnie Falco c86fee9513 Move everything in basic_fields.hpp to fields.hpp (API Change)
fix #320
2017-05-05 21:00:55 -07:00
Vinnie Falco a14a5d6b05 Rename to detail::is_invocable
Fix #323
2017-05-05 21:00:55 -07:00
Vinnie Falco 540d0373dc Rename to websocket::detail::pausation
Fix #324
2017-05-05 21:00:55 -07:00
Vinnie Falco 84e173943b Document websocket::stream thread safety
fix #329
2017-05-05 10:01:18 -07:00
Vinnie Falco dc274afcfa 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-05-05 10:01:18 -07:00
Vinnie Falco 2c17d04a3a 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-05-05 10:01:17 -07:00
Vinnie Falco 235fe68acb 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-05-05 10:01:17 -07:00
Vinnie Falco a715825dc4 CMake hide command lines in .vcxproj Output windows 2017-05-05 10:01:15 -07:00
Vinnie Falco 32024d8b50 Set version to 1.0.0-b36 2017-05-05 09:55:01 -07:00
Vinnie Falco f48b95ffd5 Update README.md 2017-05-05 09:54:58 -07:00
Vinnie Falco d8db5f1a0d Set version to 1.0.0-b35 2017-05-04 18:58:38 -07:00
Vinnie Falco dd2a514ef2 Tidy up doc declarations 2017-05-04 18:58:34 -07:00
Vinnie Falco 2c50ababe0 Fix README.md CMake instructions
fix #318
2017-05-04 18:58:34 -07:00
Vinnie Falco 4ffdce2dae Update .gitignore for VS2017 2017-05-04 18:58:34 -07:00
Vinnie Falco 403011fdbe Remove http::empty_body (API Change) 2017-05-04 18:58:33 -07:00
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 3de46de96c Make websocket::close_code a proper enum:
fix #311

This changes close_code to be a proper enumeration.
2017-04-23 08:26:17 -07:00
Vinnie Falco 0128743dda Tidy up MSVC CMake configuration 2017-04-23 08:25:57 -07:00
Vinnie Falco ccd188ea1c Add appveyor build script
Fix #75
2017-04-20 13:24:58 -07:00
Vinnie Falco 6d5547a32c Set version to 1.0.0-b34 2017-04-19 11:49:39 -07:00
Vinnie Falco 6fab138150 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-04-19 11:49:34 -07:00
Vinnie Falco ccefa54bf5 Set version to 1.0.0-b33 2017-04-14 19:30:33 -07:00
Vinnie Falco 32afe415c4 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-04-14 19:25:05 -07:00
Vinnie Falco fe3e20b645 Add write_frames unit test 2017-04-14 19:25:05 -07:00
Vinnie Falco 578dcd0a78 Add decorator unit test
fix #302
2017-04-14 19:24:57 -07:00
Vinnie Falco aaa3733bee Use fwrite return value in file_body 2017-04-12 18:36:59 -07:00
Vinnie Falco df661658ee Require Visual Studio 2015 Update 3 or later
fix #216
2017-04-12 18:36:59 -07:00
Vinnie Falco b8e5a21bfd Set version to 1.0.0-b32 2017-04-10 16:48:16 -07:00
Sergey Lyubimov ffb17589d0 Update CMake scripts for finding packages:
These changes require CMake version 3.7.2 or later.
2017-04-10 16:47:58 -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 27864fb3dd Add io_service completion invariants tests
fix #290
2017-03-31 10:39:11 -04:00