84 Commits
Author SHA1 Message Date
Hreniuc Cristian-Alexandru 91c0df61d0 Fix reuse of sliding window in WebSocket permessage_deflate:
Original commit message:
Use zlib::Flush::sync instead of zlib::Flush::full, for stream compression

https://github.com/boostorg/beast/issues/2313

fixes #2313
closes #2318
2021-11-03 18:46:53 +01:00
Damian Jarek 5f0939e771 Simplify websocket::detail::prng:
- Use a regular function pointer for dynamic dispatch.
- Remove `prng::ref` - it did not benefit the default case
  (TLS avaialable) and actually made the no-TLS case slower, because
  the time spent in the generator is dominated by mutex locking.

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2019-07-01 12:49:01 -07:00
Damian Jarek 1635df0e11 Simplify generation of sec-websocket-key
The result of `g()` is a random number, therefore it's not necessary
to care about endianness in this case.

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2019-06-24 11:07:41 -07:00
Damian Jarek b8b04f8f39 Cleanup transitive includes in beast/core/detail/type_traits.hpp
Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2019-06-24 11:07:41 -07:00
Damian Jarek 153408eb5b More split compilation in websocket/detail/mask.hpp
Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2019-06-23 16:58:15 +02:00
Damian Jarek 1a720c8354 Qualify calls to beast::iequals in basic_parser.ipp
Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2019-06-23 16:58:15 +02:00
Damian Jarek a0d5baf22a Improve performance of http::string_to_verb
`operator==` performs better than the hand-written comparison routine.

fix #1636

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2019-06-19 17:53:35 +02:00
Damian Jarek a7ff1a41e7 Remove redundant instation of static_string in websocket
Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2019-06-19 17:53:33 +02:00
Damian Jarek d52b4e4bd3 Fix clang inititalization warning in websocket
Clang suggests using double braces when initializing a single subobject
of an aggregate.

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2019-05-31 02:04:36 +02:00
Vinnie Falco e53ccf251c Fix min/max on MSVC
fix #1578
2019-04-19 11:36:00 -07:00
Damian Jarek 8703038e37 launder pointers:
close #1570

`std::launder` must be used whenever placement-new of an unknown type
is performed and the result of the placement-new expression is discarded.

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2019-04-15 08:21:48 -07:00
Damian Jarek bc9f63f10d Cleanup endianness conversions:
close #1544

- Use Boost.Endian conversions functions.
- Remove existing private conversion functions.

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2019-04-08 17:14:04 -07:00
Vinnie Falco 7c084509d6 decorator constructor is constrained 2019-04-02 16:49:05 -07:00
Damian Jarek dc52df351a Enable more split compilation in websocket and http
Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2019-03-10 13:23:22 -07:00
Vinnie Falco 9f2b0ce1db Rename to buffer_bytes 2019-03-05 11:09:53 -08:00
Vinnie Falco 6ccdcdf51d buffer_size is in buffer_traits.hpp 2019-03-05 11:09:50 -08:00
Damian Jarek 8f83b4e611 Fix UB in decorator:
- don't assume layout or size overhead of classes with
  virtual members (use split vtable)
- don't use SOO for types with throwing move

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2019-03-04 14:44:15 -08:00
Vinnie Falco 4eb137f8ea Fix decorator for certain sizes 2019-03-03 17:13:56 -08:00
Vinnie Falco 62878255fb Workaround for msvc-14.0 2019-03-03 12:52:35 -08:00
Vinnie Falco ef5282ebcf Tidy up websocket service 2019-02-27 16:44:04 -08:00
Vinnie Falco 92ad50a8e7 Destroy abandoned websocket ops on shutdown
fix #1358
2019-02-27 16:44:01 -08:00
Vinnie Falco 031e13c253 Add websocket service 2019-02-27 16:42:19 -08:00
Vinnie Falco 0647c902ac role_type is in boost/beast/core/role.hpp (API Change):
This enumeration is now part of the library core and
not specific to websocket.
2019-02-26 07:20:46 -08:00
Vinnie Falco 955354b9dd Enable split Beast compilation for tests 2019-02-22 17:27:27 -08:00
Vinnie Falco ee13bfad70 Fast prng is pcg 2019-02-21 13:19:23 -08:00
Vinnie Falco 6ada618c12 Check BOOST_NO_CXX11_THREAD_LOCAL 2019-02-21 11:09:02 -08:00
Vinnie Falco eea3929b26 Concept check tidying 2019-02-20 19:19:59 -08:00
Vinnie Falco 6baa607295 Fixes to support Asio changes (API Change):
This adjusts Beast's interfaces and implementation to match
the changes in Boost.Asio.
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 085fb66b26 websocket test coverage 2019-02-18 12:18:27 -08:00
Vinnie Falco e831e8b7ee Add detail::decorator 2019-02-18 12:18:27 -08:00
Vinnie Falco f21358186e Add websocket::stream timeouts 2019-02-18 12:18:27 -08:00
Vinnie Falco dfd08bf6ae Refactor websocket::stream operations 2019-02-18 12:18:27 -08:00
Vinnie Falco d2669d2a78 is_invocable is in its own header file 2019-02-05 10:11:02 -08:00
Vinnie Falco 44d9eaba4d Tidying 2019-02-05 09:56:48 -08:00
Vinnie Falco 35dbd140d4 Add buffer_size 2019-02-03 12:59:11 -08:00
Vinnie Falco a142969c5d Qualify buffer_copy, don't qualify buffer_size:
fix #1416

* Calls to buffer_copy are qualified as net::buffer_copy
* Calls to buffer_size are made unqualified, permitting
  argument dependent lookup to take effect.
2019-02-02 13:01:27 -08:00
Vinnie Falco 9a8e22950f websocket stream uses shared_ptr<impl_type> 2019-01-21 08:44:14 -08:00
Vinnie Falco 944b5dcda7 Clear error codes idiomatically 2019-01-20 09:50:43 -08:00
Vinnie Falco 4d0849595c Add detail/prng.hpp 2019-01-20 07:05:16 -08:00
Vinnie Falco 785c0ad93d Add detail/soft_mutex.hpp 2019-01-20 07:05:16 -08:00
Vinnie Falco cf2dbdc0be Use new saved_handler in websocket 2019-01-15 11:42:05 -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 c4f4087888 Add buffers_range_ref (replaces reference_wrapper parameter) 2018-12-19 21:51:49 -08:00
Vinnie Falco b6eb988694 saved_handler maintains a work_guard (websocket):
* Tidy up and comment asserts

* `pausation` is renamed to saved_handler

* A work guard on the handler's associated executor
  is maintained for the lifetime of the store handler.
2018-12-12 19:32:22 -08:00
Vinnie Falco b3a8e6edb5 Tidy up calls to placement new 2018-12-02 19:48:42 -08:00
Vinnie Falco f995fd41a3 net is a namespace alias for boost::asio:
The namespace alias beast::net replaces boost::asio in all code
and documentation.
2018-12-02 17:51:43 -08:00
Damian Jarek 8930d437b5 Enable explicit instantiation of websocket::stream:
fix #1279, close #1319

This enables users to improve compilation performance by explicitly
instantiating the stream template in another TU.

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2018-11-26 18:38:09 -08:00
Damian Jarek c0e5d1bd76 Use mp11::integer_sequence
Close #1317

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2018-11-26 15:30:48 -08:00
Vinnie Falco 071cab92d5 Add buffers_range 2018-11-12 06:39:36 -08:00