Commit Graph

458 Commits

Author SHA1 Message Date
Vinnie Falco
c681241d70 Large WebSocket Upgrade response no longer overflows
fix #1460
2019-02-20 18:58:59 -08:00
Vinnie Falco
51994d133f Release notes 2019-02-20 18:58:59 -08:00
Vinnie Falco
fd4b080a4a RatePolicy documentation 2019-02-20 15:30:03 -08:00
Vinnie Falco
093f966f69 Disable bind_continuation 2019-02-20 15:30:02 -08:00
Vinnie Falco
28f5921bd6
Set version to 216 2019-02-20 07:12:11 -08:00
Vinnie Falco
c5b655c954 basic_stream connects are members 2019-02-19 16:27:27 -08:00
Vinnie Falco
23a7bcc67e Add RatePolicy to basic_stream 2019-02-19 16:23:30 -08:00
Vinnie Falco
ac24e58fb3 Add make_strand 2019-02-19 16:23:30 -08:00
Vinnie Falco
3f50efa138 WebSocket Decorator is a socket option (API Change):
This changes the interface used to apply a decorator to the HTTP
request or response messages used to perform the WebSocket handshake
as follows:

* Add the `stream_base::decorator` option object

* Add `stream::set_option` overload to set the decorator from
  the option

* The decorator applies to all client and server handshakes
  performed on the stream after the option is set.

* Overloads of the following functions which accept a Decorator
  are deprecated:
  - accept, accept_ex
  - handshake, handshake_ex
  - async_accept, async_accept_ex
  - async_handshake, async_handshake_ex

Actions Required:

* Code which passes decorator to any `websocket::stream` member
  function should call `stream::set_option` instead with a newly
  constructed `stream_base::decorator` object containing the
  decorator. Alternatively, the macro `BOOST_BEAST_ALLOW_DEPRECATED`
  may be defined to 1.
2019-02-19 16:23:30 -08:00
Vinnie Falco
79c777e776 Tidying and fixes 2019-02-18 12:18:27 -08:00
Vinnie Falco
fc7b47fc5d Use suggested timeouts in Websocket examples 2019-02-18 12:18:27 -08:00
Vinnie Falco
22dcb4a3cb example/cppcon2018 is removed:
* Replaced by websocket-chat-multi
2019-02-16 15:09:35 -08:00
Vinnie Falco
f41363c60c Add async_op_base::invoke 2019-02-16 15:09:33 -08:00
Vinnie Falco
d410b429c0 Remove bind_back_handler 2019-02-14 16:11:14 -08:00
Vinnie Falco
ebc5246c47 Rewrite the echo-op example
fix #1450
2019-02-13 14:14:34 -08:00
Vinnie Falco
9b14774ada basic_stream subsumes stranded_stream:
* All functionality of stranded_stream is folded into basic_stream
* tcp_stream is an alias for basic_stream with tcp
* The tests are expanded to produce full coverage
* Timeout implementation is simplified
2019-02-10 11:42:01 -08:00
Vinnie Falco
168f674b4a Improved websocket stream documentation
fix #1213
2019-02-10 05:51:42 -08:00
Vinnie Falco
b8aa6be7fd stranded_socket tests and tidy 2019-02-08 10:58:23 -08:00
Vinnie Falco
27a6f57200 Add flat_stream:
flat_stream, previously in _experimental, is now a public API.
2019-02-07 17:37:18 -08:00
Vinnie Falco
3896f9aa9c Add stranded_stream 2019-02-07 17:37:18 -08:00
Damian Jarek
34362256c0 Fixes to test::stream::async_read:
- Call the completion handler with the correct signature
- Replicate ASIO socket behavior of async operation completions
- Fix a data race between read_op and a call to stream::nread()

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2019-02-05 16:14:45 -08:00
Vinnie Falco
adcd4bc0c9 is_completion_handler, type_traits.hpp are deprecated (API Change):
* is_completion_handler is deprecated
* type_traits.hpp is a deprecated include

These items will be removed in the next version

* Include the new header file for the types needed:
  - stream_traits.hpp
  - file_base.hpp
* Use std::is_invocable instead of is_completion_handler
2019-02-05 14:16:30 -08:00
Vinnie Falco
8ea8f41bba is_file is in file_base.hpp (API Change):
* The metafunction `is_file` is part of file_base.hpp

Actions Required

* Include file_base.hpp as needed
2019-02-05 09:56:49 -08:00
Vinnie Falco
477cd75153 Stream traits are in stream_traits.hpp (API Change):
These metafunctions are moved from type_traits.hpp
to stream_traits.hpp:

- has_get_executor
- is_sync_stream
- is_sync_read_stream
- is_sync_write_stream
- is_async_stream
- is_async_read_stream
- is_async_write_stream

Actions Required:

* Include the file stream_traits.hpp as needed
2019-02-05 09:56:34 -08:00
Vinnie Falco
9cee4e053f Add executor_type trait 2019-02-05 07:46:09 -08:00
Vinnie Falco
e082caae76 Update interim release notes 2019-02-03 17:17:55 -08:00
Vinnie Falco
35dbd140d4 Add buffer_size 2019-02-03 12:59:11 -08:00
Vinnie Falco
64149f434a Refactor quickref.xml 2019-02-03 12:59:11 -08:00
Vinnie Falco
17ada67f0d Add dynamic_buffer_ref 2019-02-02 16:14:10 -08:00
Vinnie Falco
74f02f8ac5 Doc work 2019-02-01 14:05:07 -08:00
Vinnie Falco
49deee4a69 Add close_socket, beast_close_socket customization:
This algorithm allows a socket-like object to be closed in
a generic context. The customization point enables user-defined
types to define the close algorithm to use with `close_socket`.
2019-02-01 14:05:07 -08:00
Vinnie Falco
6a658b5c3a Remove lowest_layer, add get_lowest_layer (API Change):
fix #1417

* New get_lowest_layer free function works for any object
* New lowest_layer_type trait works for any object
* New examples and documentation on layered streams

API Changes:

* The member function lowest_layer is removed from all
  types provided by the library:

Actions Required:

* Call the free function get_lowest_layer instead of
  member lowest_layer.
2019-02-01 04:31:13 -08:00
Vinnie Falco
60c96104ec lowest_layer is removed (API Change):
The nested function lowest_layer and nested type lowest_layer_type
are removed from all stream layers.

Actions Required:

* Remove lowest_layer and lowest_layer_type from user-defined streams.
* Use the get_lowest_layer free function and the lowest_layer_type trait
  as needed.
2019-01-22 04:59:07 -08:00
Vinnie Falco
3081f52ad5 Add websocket-chat-multi example:
This is the multi-threaded io_context version of the
CppCon2018 WebSocket chat server and client example.
2019-01-21 12:13:04 -08:00
Vinnie Falco
9a8e22950f websocket stream uses shared_ptr<impl_type> 2019-01-21 08:44:14 -08:00
Vinnie Falco
d7cc7a6d1e Doc work 2019-01-20 07:05:16 -08:00
Vinnie Falco
4fcd6601b3 Doc work 2019-01-17 17:20:10 -08:00
Vinnie Falco
72ea142c5c Add basic_timeout_stream:
This stream wrapper replaces basic_stream_socket and
provides just the timeout functionality.

* basic_stream_socket is removed
2019-01-17 17:18:31 -08:00
Vinnie Falco
3092e43879 saved_handler is a public interface:
This container allows completion handlers to be safely
suspended and resumed later, or destroyed.
2019-01-12 18:42:32 -08:00
Vinnie Falco
3595eb2221 Update networking refresher doc 2019-01-12 13:11:00 -08:00
Vinnie Falco
5292df6e72 async_op_base is a public interface:
This utility simplifies the authoring of composed
operations, see documentation for details.
2019-01-09 09:54:53 -08:00
Vinnie Falco
6caca92f0e New stream_socket:
This I/O object wraps an ordinary socket and provides a built-in
timeout and optional bandwidth rate-limiting facility.

Added class template basic_stream_socket

* Meets the requirements of AsyncReadStream and AsyncWriteStream

* Partially supports P1322R0:
  "Networking TS enhancement to enable custom I/O executors"
  http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1322r0.html

  A strand or other io_context-compatible executor may be
  chosen to use for all asynchronous stream operations.

* Supports independent timeouts on logical operations:
  connect, read, write, or both read and write.

* Provides an option for a configurable rate limit
  limit on the maximum rates of reading or writing.

* The previous experimental implementation,
  `timeout_socket` and related types, is removed.

* stream_socket is an alias for basic_stream_socket which
  uses `net::ip::tcp` as its protocol.
2018-12-30 16:49:09 -08:00
Vinnie Falco
2d3912751b Add core errors and conditions 2018-12-30 12:51:34 -08:00
Vinnie Falco
92e598ade3 Add bind_back_handler
fix #1384
2018-12-21 06:35:07 -08:00
Vinnie Falco
c4f4087888 Add buffers_range_ref (replaces reference_wrapper parameter) 2018-12-19 21:51:49 -08:00
Tocic
3a3f9c459e Fix typo 2018-12-19 21:51:49 -08:00
Vinnie Falco
0006ab3b2b make_printable replaces buffers rename (API Change):
* The function buffers is deprecated, use the new
  function make_printable as the replacement.

Actions Required:

* Replace call sites to use make_printable instead of buffers,
  and also include make_printable.hpp instead of ostream.hpp.
2018-12-19 20:59:20 -08:00
Vinnie Falco
8f1faababd Add buffers_iterator_type trait 2018-12-19 20:59:20 -08:00
Vinnie Falco
1998bad89d Add const and mutable buffer sequence traits:
* Add variadic is_const_buffer_sequence
* Add variadic is_mutable_buffer_sequence
* buffers_type is now variadic
2018-12-19 20:59:20 -08:00
Vinnie Falco
117dda7b31 Refactor buffers_adaptor (API Change):
* Tidy up tests
* Increase code coverage
* Remove move special members
* Correct behavior for default constructed iterators

API Changes:

* buffers_adaptor is renamed (was buffers_adapter)

Actions Required:

* Replace buffers_adapter.hpp with buffers_adaptor.hpp, and
  replace buffers_adapter with buffers_adaptor. Or, define
  BOOST_BEAST_ALLOW_DEPRECATED
2018-12-19 20:59:20 -08:00
Vinnie Falco
120d5481e2 Tidy up core files 2018-12-12 19:32:22 -08:00
Vinnie Falco
0a583a331d Add buffer_traits.hpp, buffers_type 2018-12-12 19:32:22 -08:00
Vinnie Falco
35e4f321bc Refactor HTTP operations (API Change):
* Revise stream algorithm javadocs

* HTTP stream algorithms now use beast::read and
  beast::async_read with a custom completion condition.

API Changes:

* HTTP stream algorithms return the number of bytes transferred
  from the stream. Previously, they returned the number of bytes
  consumed by the parser.

Actions Required:

* Callers depending on the return value of http::read or
  http::async_read overloads should adjust the usage of
  the returned value as needed.
2018-12-06 15:50:26 -08:00
Vinnie Falco
7005f6b918 Documentation work 2018-12-02 17:52:04 -08:00
Vinnie Falco
02fb4983f6 Fixes to timeout services (experimental) 2018-11-26 15:30:49 -08:00
Vinnie Falco
cd07e5bce8 Fix link in docs
fix #1296
2018-11-26 15:30:49 -08:00
Vinnie Falco
d09d6a2063 Documentation qbk fixes and edits:
* Fix broken link
* More concepts
2018-11-26 15:30:44 -08:00
Vinnie Falco
c0695db877 Merge master into develop 2018-11-26 15:26:51 -08:00
Vinnie Falco
cf6021a355 Fix broken doc link 2018-11-26 12:04:03 -08:00
Vinnie Falco
d581bcc348 Add bind_front_handler:
This works similarly to bind_handler, and can help with reducing
template instantiations and compiler memory usage (since it does
not need to support placeholders).

A specialization for the most common case `void(error_code, size_t)`
is provided to minimize instantiation cost.
2018-11-21 12:47:38 -08:00
Vinnie Falco
9666178957 Fix Doxygen configuration 2018-11-21 12:10:52 -08:00
Vinnie Falco
071cab92d5 Add buffers_range 2018-11-12 06:39:36 -08:00
Vinnie Falco
450964b78f Squashed 'doc/docca/' changes from 1bfc5ede..df9bd956
df9bd956 Add deduced alias
220ded9a Add see-below alias

git-subtree-dir: doc/docca
git-subtree-split: df9bd956e2480467447c80ffae3b44b3c0b0756a
2018-11-11 22:25:56 -08:00
Vinnie Falco
bc2f5f1426 Add CppCon2018 chat server example and video 2018-11-08 16:46:38 -08:00
Vinnie Falco
04bac8dce9 Remove extraneous strand from example
fix #1288
2018-11-03 19:30:16 -07:00
Vinnie Falco
65434a0cba Partial support for BOOST_NO_EXCEPTIONS:
Some stream operations are modified to use a
helper function which supports BOOST_NO_EXCEPTIONS.
2018-11-01 21:10:54 -07:00
Vinnie Falco
30ca9c59d3 Fix uninitialized comparison in buffers iterator
fix #1263
2018-11-01 21:10:54 -07:00
Vinnie Falco
ef0658f678 Add experimental timeout_socket:
This is a socket wrapper which has a built-in timeout feature on
reads and writes.
2018-10-28 19:43:28 -07:00
compmaniak
955b7b31a5 Fix parsing of out-of-bounds hex values
fix #1267
2018-10-20 08:40:27 -07:00
Vinnie Falco
29e9ad5370 basic_fields uses intrusive base hooks:
fix #1270

basic_fields::value_type uses base hooks instead of member hooks,
otherwise MSVC can sometimes produce undefined behavior when
attempting to recover the base class from a data member in
certain build configurations.
2018-10-19 17:42:30 -07:00
jarle
2b977f2770 Fix timer on websocket upgrade in examples
fix #1091, fix #1240, fix #1253
2018-10-07 10:38:36 -07:00
Domen Vrankar
806979e37b Add BOOST_BEAST_USE_STD_STRING_VIEW:
fix #1133, fix #1241

When the macro BOOST_BEAST_USE_STD_STRING_VIEW is defined,
Beast will use std::string_view instead of boost::string_view.

The name boost::beast::string_view is a type alias for the
chosen view type.
2018-10-07 10:38:36 -07:00
luz.paz
f3212eba48 Fix some typos:
fix #1255

Found via `codespell -q 3 -L uint,te,tim --skip="./test/extern/zlib*,./example/http/client/crawl*"`
2018-10-07 10:35:12 -07:00
Vinnie Falco
82e87ea188 Workaround for http-server-fast and libstdc++:
This fixes a problem where libstdc++ incorrectly assumes that the
allocator used with basic_string is DefaultConstructible.

See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56437
2018-09-23 19:08:30 -07:00
Glen Fernandes
5e98c78951 Use boost::empty_value
fix #1233
2018-09-23 10:12:08 -07:00
PeterW3
4643b0565e Verify certificates in client examples:
fix #1237

HTTP client examples now verify the server's certificate
and generate an error if the certificate is invalid or
expired:

* Set certificate verify mode
* Remove duplicate root certificate
2018-09-23 10:12:08 -07:00
Boris Sergeev
a4c008907d Fix a rare case of incorrect UTF8 validation
fix #1245, fix #1249

The value used to fill the incomplete code point buffer is
changed to a character which no longer causes
utf8_checker::valid() to incorrectly return false.
2018-09-23 10:12:07 -07:00
Vinnie Falco
f32a8e2c99 Silence ubsan false positive
fix #1214
2018-08-02 07:20:47 -07:00
compmaniak
802390886d Fix parse_dec algorithm
fix #1211
2018-07-29 17:05:11 -07:00
felixguendling
ba4bdfed71 Fix http_server_stackless_ssl.cpp example
fix #1210

Write to self_.stream_ instead of the socket_ directly
2018-07-28 07:00:51 -07:00
Vinnie Falco
dd6dff92ab Typo in release notes 2018-07-15 08:32:52 -07:00
Vinnie Falco
e9e5d159c6
Set version to 177 2018-07-12 11:10:00 -07:00
Vinnie Falco
749e54f31b Generated WebSocket masks use a secure PRNG by default:
This resolves a medium vulnerability described in the
Beast Hybrid Assessment Report by Bishop Fox, where masks generated
for use with outgoing WebSocket client frames use an insufficient
source of entropy and a non-cryptographically secure pseudo-random
number generator.

By default, all newly constructed WebSocket streams will use a
uniquely seeded secure PRNG (ChaCha20 in counter mode). As this may
result in increased CPU resource consumption, the function
websocket::stream::secure_prng() may be used to select a faster but
less secure PRNG, for the case where the caller knows that the secure
generator is not necessary.

On some systems, std::random_device may produce insufficient entropy
to securely seed the PRNG. As this condition cannot be detected by
Beast, callers may use the function websocket::seed_prng() called
once at startup to provide at least 256 bits of entropy which will
be used to uniquely seed all subsequent PRNGs.
2018-07-08 15:20:05 -07:00
Vinnie Falco
20eb6af42d Tidy up Quick Reference 2018-07-04 14:35:59 -07:00
Vinnie Falco
e97d70d329 Update Release Notes 2018-06-29 10:05:55 -07:00
Vinnie Falco
436f6f96b1 Fix BodyReader constructor requirements doc 2018-06-18 11:09:50 -07:00
Vinnie Falco
37c90220d0 Fix Fields, FieldsWriter concept docs 2018-06-18 08:42:24 -07:00
Vinnie Falco
6647e9ea56 Add experimental icy_stream Shoutcast stream filter:
fix #595, fix #1151

This provides a stream filter which converts the ICY HTTP
response handshake at the beginning of a stream to HTTP/1.1.
2018-06-09 21:12:01 -07:00
Vinnie Falco
c9298f6522 Remove Autobahn testsuite doc note 2018-05-31 06:27:00 -07:00
Vinnie Falco
5b1022d63e Tidy up composed operation doc
fix #1141
2018-05-29 15:33:55 -07:00
Vinnie Falco
f5def127d8 Tidy up test::stream javadocs 2018-05-29 15:32:01 -07:00
Vinnie Falco
07aead170a Add is_mutable_body_writer metafunction 2018-05-04 19:34:05 -07:00
Vinnie Falco
73bc28aaa2 Remove deprecated serializer::reader_impl() 2018-05-03 19:42:36 -07:00
Vinnie Falco
a94efc8c92 Add test::stream to experimental 2018-05-02 08:32:09 -07:00
Vinnie Falco
e4c2ae6384 Add test::fail_count to experimental 2018-05-02 08:32:09 -07:00
Vinnie Falco
292801fef7 Add ssl_stream to experimental:
The ssl_stream wrapper provides C++11 move semantics for ssl::stream,
as well as incorporating the flat_stream workaround for a performance
problem with ssl::stream writes and buffer sequences having length
greater than one.
2018-05-02 08:32:09 -07:00
Vinnie Falco
6108cf3eb7 Add flat_stream to experimental:
This adds a new stream wrapper class template designed to address
a performance shortcoming of boost::asio::ssl::stream.
2018-05-02 08:32:07 -07:00
Vinnie Falco
c9a445a937 New flat_stream example class:
fix #1108

The `flat_stream` is a stream wrapper designed to overcome a
performance limitation of the `boost::asio::ssl::stream`
implementation. Specifically, when writing buffer sequences having
length greater than one, the `ssl::stream` implementation does
not use scatter-gather I/O and instead performs a kernel transition
for every buffer in the sequence.

The wrapper addresses this problem by allocating memory and
presenting the buffer sequence into a single buffer, using
some logic to determine when this allocation is advantageous
versus simply passing the buffers through as-is.

See Also:
https://github.com/boostorg/asio/issues/100
https://stackoverflow.com/questions/50026167/performance-drop-on-port-from-beast-1-0-0-b66-to-boost-1-67-0-beast
2018-04-30 19:49:42 -07:00
Vinnie Falco
86342dd72b Use executor_work_guard in composed operations:
fix #1076

As per Asio and Networking TS requirements, composed operations must
maintain an object of type executor_work_guard for the executor associated
with the I/O object, for the lifetime of the asynchronous operation.

This is in addition to the requirement for maintaining an object of type
executor_work_guard for the executor associated with the handler.
2018-04-10 08:03:04 -07:00
Ivan Vilata-i-Balaguer
edd162cf3b Add Access-Control-Expose-Headers field constant:
This response header is described both in [CORS](https://www.w3.org/TR/cors/)
and [Fetch](https://fetch.spec.whatwg.org/) specifications.
2018-03-09 09:29:14 -08:00