Commit Graph

1309 Commits

Author SHA1 Message Date
Vinnie Falco
a0932ea45c Update CHANGELOG.md 2019-04-11 14:01:51 -07:00
Vinnie Falco
1de60a0462 Move friend function template definition 2019-04-08 15:13:12 -07:00
Simon Ebner
7e78863074
Don't use a moved-from handler:
close #1560

* Obtain the executor from the handler prior
  to transferring ownership.
2019-04-06 13:23:12 -07:00
Damian Jarek
ce986118f8
Fix async_base immediate completion
`complete(false, ...)` used the wrong executor when an async operation
completed immediately, potentially executing the completion handler on
the IO executor in some cases.

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2019-04-05 05:08:31 -07:00
Vinnie Falco
90d7434847 decorator ctor is explicit 2019-04-03 11:16:38 -07:00
Vinnie Falco
7c084509d6 decorator constructor is constrained 2019-04-02 16:49:05 -07:00
Vinnie Falco
8ec1a4d90f Fix websocket keep-alive ping expiration 2019-04-01 18:14:25 -07:00
Vinnie Falco
27c572fbfa Tidy up declval in some traits 2019-04-01 17:35:44 -07:00
Denis Glazachev
058294e908 Fix http::message constructor constraint 2019-03-30 14:14:59 -07:00
Vinnie Falco
4f464ccaeb Tidy up file_stdio for VS2015 2019-03-30 14:14:59 -07:00
Denis Glazachev
24ccdd243a Fix some typos 2019-03-30 11:12:04 -07:00
Vinnie Falco
4e90183bda Check defined(BOOST_MSVC) 2019-03-29 20:42:44 -07:00
Vinnie Falco
a7faf03694 Fix http::message constructor constraint 2019-03-29 20:42:44 -07:00
Vinnie Falco
965c21615a MSVC uses ::fopen_s 2019-03-29 20:42:44 -07:00
Vinnie Falco
3c82717fed test::stream has deprecated lowest_layer for ssl 2019-03-29 17:31:18 -07:00
Vinnie Falco
51db4d491a basic_parser::content_length is stable (API Change):
fix #1375

* The value returned from `basic_parser::content_length`
  no longer changes as the body of the message is received.

Actions Required:

* Call `basic_parser::content_length_remaining` instead
  of `basic_parser::content_length`.
2019-03-29 15:05:30 -07:00
Vinnie Falco
18bf9b4037 Tidy up a doc code snippet 2019-03-28 09:53:27 -07:00
Vinnie Falco
ed9d861545 Fix ssl_stream teardown 2019-03-27 09:13:32 -07:00
Damian Jarek
5a0b4d7ebe More split compilation in HTTP
close #1541

- Remove unused private functions: `skip_ows_rev`, `skip_obs_fold`.
- Enable split compilation in `http/detail/rfc7230.hpp`.
- More split compilation in `basic_parser`.
- Remove some unnecessary includes.

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2019-03-24 11:05:24 -07:00
Vinnie Falco
61fcd9ef6f Refactor Jamfiles to work with release layout 2019-03-24 09:18:02 -07:00
Vinnie Falco
b38901887b cmake: Use static libs to speed up builds 2019-03-23 17:50:38 -07:00
tal
894917cb23
root_certificates.hpp: brought in the server certificate
close #1537

This allows for the self-sign ssl to work
2019-03-21 19:59:15 -07:00
Vinnie Falco
f5d08d7b2c Set version to 235 2019-03-21 17:23:49 +01:00
Vinnie Falco
1f560692ac Fix self-assignment warning in buffer test 2019-03-21 17:23:49 +01:00
Wes Turner
f016499206 DOC: README.md: https URLS
close #1525
2019-03-19 06:59:55 -07:00
Damian Jarek
05f3f8a5ce Remove the need for OpenSSL in examples that don't use it
close #1524

It is now possible to compile examples without OpenSSL. Examples that
do require OpenSSL will be omitted.

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2019-03-19 06:59:55 -07:00
Damian Jarek
8869ec5681
Use secure TLS/SSL versions:
TLS1.2 can be used instead, it is available in all currently
supported versions of OpenSSL.

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2019-03-14 09:56:50 -07:00
Gregor Jasny
0033b7c1e4
Android: Use compiler pre-defined __ANDROID__
The ANDROID define us usually originationg from he build system
(like CMake, ndk-build, etc.). But some buildsystems like Bazel
do not set it which brakes Android platform detection.

Better use __ANDROID__ (like boost predef does) which is
predefined by the compiler if targeting Android.
2019-03-14 09:55:22 -07:00
Vinnie Falco
fdc83c981b Fix basic_stream lowest_layer for ssl 2019-03-12 18:58:24 -07:00
Vinnie Falco
b7c3c1eb1a Fix file_win32_write_op async initiation 2019-03-12 18:07:19 -07:00
Vinnie Falco
554701845c Fix close_socket for net::basic_socket changes 2019-03-12 16:20:36 -07:00
Vinnie Falco
cfbdce3e5c Constrain to_static_string to integers 2019-03-12 13:44:48 -07:00
Vinnie Falco
30d1972aa2 Add missing include 2019-03-11 13:24:20 -07:00
Damian Jarek
b9aad3d06c Fix completion handler invocation signatures
Completion handlers should be called with the exact same signature as
provided to `async_result`.

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2019-03-07 12:56:40 -08:00
Vinnie Falco
fdf64a4550 Remove dynamic_buffer_ref:
* dynamic_buffer_ref is removed, because Asio / Networking
  has introduced the DynamicBuffer_v2 concept which is incompatible
  with Beast's storage types.

The next version of Beast (1.70) will provide changes to
interoperate with Asio / Networking's new concepts.
2019-03-07 12:56:40 -08:00
Vinnie Falco
f4e2a327c8 Don't use dynamic_buffer_ref 2019-03-07 12:56:40 -08:00
Vinnie Falco
06a42f2202 Fix stable_async_base example 2019-03-06 10:38:08 -08:00
Vinnie Falco
45353a7f04 handler_ptr is deprecated (API Change):
* `handler_ptr` is deprecated and should not be used.

Actions Required:

* Replace use of `handler_ptr` with `stable_async_base`
  and `allocate_stable`.
2019-03-06 10:38:08 -08:00
Vinnie Falco
7f53b0f66c detect_ssl returns a bool
fix #1288
2019-03-06 05:50:22 -08:00
Vinnie Falco
b51c4bb49a Tidy up examples 2019-03-06 05:40:49 -08:00
Vinnie Falco
9f2b0ce1db Rename to buffer_bytes 2019-03-05 11:09:53 -08:00
Vinnie Falco
31331bbe4d
Set version to 228 2019-03-04 18:33:27 -08:00
Vinnie Falco
e4342b51b2 SSL teardowns are in an associated namespace 2019-03-04 18:33:24 -08:00
Vinnie Falco
7f5a405e61 Tidy up quick reference 2019-03-04 14:45:10 -08:00
Vinnie Falco
1d8871c2f9 Fix includes.xsl for newer doxygen 2019-03-04 14:45:00 -08:00
Vinnie Falco
31c5d1f092 The Fields concept is deprecated (API Change):
* The Fields concept will be removed in a future version.
2019-03-04 14:44:48 -08:00
Vinnie Falco
75c3ca622f Sync up convenience headers 2019-03-04 14:44:31 -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
0e4e7ff370 ~basic_parser is virtual 2019-03-03 19:31:52 -08:00
Vinnie Falco
4eb137f8ea Fix decorator for certain sizes 2019-03-03 17:13:56 -08:00
Vinnie Falco
ca783225da Appveyor uses msvc-14.0 2019-03-02 10:51:56 -08:00
Vinnie Falco
1432d336be Move parser definitions to .ipp 2019-03-02 09:13:08 -08:00
Vinnie Falco
edf5b7cd03 Fix HTTP parser static string calculation 2019-03-02 09:13:08 -08:00
Vinnie Falco
fca4b3ae10 make_strand is in net:: 2019-03-02 07:33:57 -08:00
Vinnie Falco
8c53abe6e5 Support -fno-exceptions 2019-03-01 13:52:50 -08:00
Vinnie Falco
737d7a97e6 Remove session_alloc (API Change)
* session_alloc is removed, as it does not improve
  performance as intended.

Actions Required:

* Don't use session_alloc
2019-03-01 12:02:40 -08:00
Vinnie Falco
272b6f23e4 Examples use flat_buffer
fix #1488
2019-03-01 12:02:28 -08:00
Vinnie Falco
7806672f42 Fix wsload jamfile 2019-03-01 11:28:44 -08:00
Vinnie Falco
bf2523b190 Tidy up an unused function 2019-03-01 11:02:52 -08:00
Vinnie Falco
00487f1de6 Reusing an HTTP parser returns an error 2019-02-28 10:27:43 -08:00
Vinnie Falco
8eb15148d7 Advanced servers use HTTP parser interfaces for reading 2019-02-28 10:04:52 -08:00
Vinnie Falco
16280f9991 Remove extraneous error check in advanced-server-flex
fix #1484
2019-02-28 07:54:20 -08:00
Vinnie Falco
92ad50a8e7 Destroy abandoned websocket ops on shutdown
fix #1358
2019-02-27 16:44:01 -08:00
Damian Jarek
72a99c43a7 Pausation abandoning test
Check if paused operations are correctly abandoned when the
ExecutionContext shuts down.

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2019-02-27 16:42:41 -08:00
Vinnie Falco
031e13c253 Add websocket service 2019-02-27 16:42:19 -08:00
Vinnie Falco
c510662c67 Add test::stream::service 2019-02-27 14:05:16 -08:00
Vinnie Falco
8f9eed1faf stream_base::timeout::suggested is a nested function 2019-02-27 06:52:45 -08:00
Vinnie Falco
7953ac281f Pass references as pointers to async_initiate 2019-02-26 07:21:05 -08:00
Vinnie Falco
ab9a4c66e0 Doc work 2019-02-26 07:21:04 -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
81f33a0f89 Rename to async_base, stable_async_base 2019-02-26 07:20:08 -08:00
Vinnie Falco
6331e03a3a OpenSSL is required for tests and examples 2019-02-23 11:15:59 -08:00
Vinnie Falco
59bda5d9c6 basic_parser is abstract, not CRTP (API Change):
* `basic_parser` now uses pure virtual member functions instead
  of the curiously recurring template pattern.

Actions Required:

* Change uses of the `basic_parser` type to omit the `Derived`
  template parameter

* Classes derived from `basic_parser` no longer need to friend
  the base.

* Virtual functions in the derived class may be marked `override`.
2019-02-23 11:15:59 -08:00
Vinnie Falco
bbd62dd181 ssl_stream is a public interface 2019-02-23 09:57:45 -08:00
Vinnie Falco
094f5ec5cb Better treatment of SSL short reads:
fix #38

This improves the behavior when encountering a short read:

* Any stream error encountered during a read is converting into
  `http::error::partial_message` if some data was received but
  the message is incomplete.

* Examples squelch SSL short read errors from the logs.
2019-02-23 08:56:59 -08:00
Vinnie Falco
73c7f3ea3e Visual Studio 2017 minimum requirement for Windows 2019-02-22 18:46:09 -08:00
Damian Jarek
d048aa8e7e More split definitions in test::stream
Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2019-02-22 17:42:44 -08:00
Vinnie Falco
955354b9dd Enable split Beast compilation for tests 2019-02-22 17:27:27 -08:00
Damian Jarek
4a5ab9785c Add OpenSSL installation/setup instructions
Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2019-02-22 17:27:11 -08:00
Vinnie Falco
90b783cb62 detect_ssl, async_detect_ssl are public interfaces 2019-02-22 15:39:34 -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
d08cc82e15 Use async_initiate 2019-02-21 06:39:35 -08:00
Vinnie Falco
51994d133f Release notes 2019-02-20 18:58:59 -08:00
Vinnie Falco
c3c3777661 Pass strand to async_accept 2019-02-20 15:30:03 -08:00
Vinnie Falco
fd4b080a4a RatePolicy documentation 2019-02-20 15:30:03 -08:00
Vinnie Falco
28d3b41a43 websocket idle pings 2019-02-20 07:12:36 -08:00
Vinnie Falco
28f5921bd6
Set version to 216 2019-02-20 07:12:11 -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
fc7b47fc5d Use suggested timeouts in Websocket examples 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
00e8c381cd Examples use ssl_stream
fix #1455
2019-02-16 15:09:35 -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
fdaf2ea7e1 Rename to async_op_base::invoke_now 2019-02-16 13:36:01 -08:00
Vinnie Falco
a781285e2f Add experimental test/handler.hpp 2019-02-16 13:36:01 -08:00
Vinnie Falco
18447553ca Examples use bind_front_handler 2019-02-14 17:28:54 -08:00
Vinnie Falco
92add2afa6 bind_front_handler works with member functions 2019-02-14 16:16:04 -08:00
Vinnie Falco
d410b429c0 Remove bind_back_handler 2019-02-14 16:11:14 -08:00
Vinnie Falco
5ed9f7712e basic_stream uses boost::shared_ptr 2019-02-14 12:54:32 -08:00
Vinnie Falco
ebc5246c47 Rewrite the echo-op example
fix #1450
2019-02-13 14:14:34 -08:00
Vinnie Falco
96b2944f70 Add detail::bind_continuation 2019-02-13 12:59:24 -08:00
Vinnie Falco
b6f215a00d handler binders use the associated allocator 2019-02-12 05:55:07 -08:00
Vinnie Falco
45d722874f Use tcp_stream, HTTP timeouts in advanced servers 2019-02-10 11:43:15 -08:00
Vinnie Falco
6ee1a88292 Use tcp_stream in WebSocket server examples 2019-02-10 11:42:01 -08:00
Vinnie Falco
920909673a Use tcp_stream in WebSocket client examples 2019-02-10 11:42:01 -08:00
Vinnie Falco
cab2472ee9 Use timeouts in HTTP client examples 2019-02-10 11:42:01 -08:00
Vinnie Falco
5b97fbb966 Use timeouts in HTTP server examples 2019-02-10 11:42:01 -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
0ce8ebbefd Fix posix_file::close handling of EINTR:
fix #1445

These changes optimize for Linux at the possible
expense of non-conforming platforms like HP-UX.
2019-02-10 05:52:12 -08:00
Vinnie Falco
168f674b4a Improved websocket stream documentation
fix #1213
2019-02-10 05:51:42 -08:00
Vinnie Falco
44ed20aa2c buffers_front tests 2019-02-09 06:58:59 -08:00
Vinnie Falco
b8aa6be7fd stranded_socket tests and tidy 2019-02-08 10:58:23 -08:00
Vinnie Falco
f15bbf10b4 flat_stream tests and tidy 2019-02-08 10:57:58 -08:00
Vinnie Falco
98834967c3 dynamic_buffer_ref tests and tidy 2019-02-08 10:57:41 -08:00
Daniel Sewtz
cd28598e5b Fixes to rfc7230:
fix #1435, fix #1438

* Example and test can be built on msvc v141 15.9.6
  using /std:c++17 and BOOST_BEAST_USE_STD_STRING_VIEW.

* changed string_view.to_string() to std:string(string_view),
  awaiting availability of Library Fundamentals TS here.

* Reactivated relevant tests to param_list. #ifdef 0 test
  exhibited same assertion failed error in debug mode.
  Now fixed in DEBUG on msvc v141 15.9.6 with
  BOOST_BEAST_USE_STD_STRING_VIEW and /std:c++17.

* Looked up http paramters (transfer-encoding, etc.)
  and changed tests as well as fixing comment to
  match specs.
2019-02-07 17:37:18 -08:00
Vinnie Falco
55d319a9d9 multi_buffer::clear preserves capacity 2019-02-07 17:37:18 -08:00
Vinnie Falco
c3125e8358 flat_buffer::clear preserves capacity 2019-02-07 17:37:18 -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
Vinnie Falco
812a19706a Improvements to test::stream:
The behavior of the test stream when either
end is destroyed or closed is well-defined.
2019-02-06 21:21:25 -08:00
Vinnie Falco
dc02f63050 close_socket is in stream_traits.hpp 2019-02-05 21:03:20 -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
98aed8ed49 Fix hexadecimal string conversion table:
Defect discovered by PVS-Studio
2019-02-05 09:56:36 -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
42d83b221a Add stream_traits.hpp:
get_lowest_layer, lowest_layer_type are located here now.
2019-02-05 07:45:36 -08:00
Vinnie Falco
28858c60fd Better handling of stream timeouts 2019-02-04 07:26:02 -08:00
Vinnie Falco
b70966ad47 Fix stable_async_op_base javadoc 2019-02-03 17:17:59 -08:00
Vinnie Falco
9b88446ab8 Tidy up read implementation 2019-02-03 17:17:03 -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
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
5b0b218d96 test::stream maintains a handler work guard
fix #1418
2019-02-02 10:30:12 -08:00
Vinnie Falco
599104c16a async_echo supports move-only handlers
fix #1420
2019-02-02 10:20:38 -08:00
Peter Dimov
e0db595760 Faster http::string_to_field:
* Optimize hash calculation and equality for field strings

Experiments show the digest and equality functions taking the
most time. Optimizing L1 cache usage did not show significant
improvements.
2019-02-02 10:04:43 -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
1da611fa04 Pass the correct handler in basic_timeout_stream 2019-01-22 21:25:06 -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
383b9cb7f2 Send from the strand 2019-01-21 16:07:00 -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
944b5dcda7 Clear error codes idiomatically 2019-01-20 09:50:43 -08:00