158 Commits
Author SHA1 Message Date
Vinnie Falco 00487f1de6 Reusing an HTTP parser returns an error 2019-02-28 10:27:43 -08:00
Vinnie Falco 7953ac281f Pass references as pointers to async_initiate 2019-02-26 07:21:05 -08:00
Vinnie Falco 81f33a0f89 Rename to async_base, stable_async_base 2019-02-26 07:20:08 -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 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 955354b9dd Enable split Beast compilation for tests 2019-02-22 17:27:27 -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 eea3929b26 Concept check tidying 2019-02-20 19:19:59 -08:00
Vinnie Falco b7f2792062 Fix file_body_win32
fix #1464
2019-02-20 15:30:03 -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 fdaf2ea7e1 Rename to async_op_base::invoke_now 2019-02-16 13:36:01 -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 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 9cee4e053f Add executor_type trait 2019-02-05 07:46:09 -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
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 944b5dcda7 Clear error codes idiomatically 2019-01-20 09:50:43 -08:00
Vinnie Falco ca5a70a3cd parse_until is not static
fix #1393
2019-01-15 11:42:05 -08:00
Vinnie Falco 3599ccb09a Add tests for async_op_base 2019-01-11 20:06:56 -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 b46953f1bd Use async_op_base:
Composed operation implementations use async_op_base and
stable_async_op_base, to eliminate redundant boilerplate.
2019-01-09 09:54:42 -08:00
Vinnie Falco 9e44ae7be5 Refactor async_op_base:
* Renamed to async_op_base (was operation_base)
* Executor1 is explicit
* Add stable_async_op_base refinement
2019-01-09 09:54:15 -08:00
Vinnie Falco c4f4087888 Add buffers_range_ref (replaces reference_wrapper parameter) 2018-12-19 21:51:49 -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 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
Vinnie Falco 2b16c50321 http::async_read returns the right byte count on error
fix #1223
2018-11-27 10:09:19 -08:00
Damian Jarek 836042fd24 Fix test::stream async_result transformation:
close #1322

async initiating functions must return init.result.get(). Returning the
result of post caused a compilation failure for custom completion tokens.

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2018-11-26 16:02:44 -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 15dd535c24 Use bind_front_handler:
The implementation uses bind_front_handler to reduce the
resources consumed when instantiating templates during
compilation.
2018-11-21 12:47:38 -08:00
Damian Jarek 5ade2a5050 Tidying:
fix #1311, fix #1310, fix #1309

* Remove unused include directive
* Remove redundant static_assert
* Remove redundant use of bind_handler

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2018-11-20 18:07:35 -08:00
Vinnie Falco 071cab92d5 Add buffers_range 2018-11-12 06:39:36 -08:00
Damian Jarek 1cdc1e3181 Add missing include in http/read.ipp
Fixes a compilation error that occurred when using
BOOST_ASIO_SEPARATE_COMPILATION.

Resolves: #1286

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2018-11-03 19:30:15 -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 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
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
Vinnie Falco e2d192ec78 Remove extraneous function 2018-10-07 10:35:12 -07:00
Glen Fernandes 5e98c78951 Use boost::empty_value
fix #1233
2018-09-23 10:12:08 -07:00
Glen Fernandes 8ed039200d Use the exchange() idiom in move constructors
fix #1203
2018-07-23 09:19:16 -07:00
Vinnie Falco 92d34b9e3b Use static_cast instead
fix #1163
2018-07-15 09:11:15 -07:00
Vinnie Falco 24bbda7b0d Add const and non-const overloads for message based http writes:
fix #1113

This solves a problem where the message-oriented synchronous
HTTP write algorithms do not support messages whose body
writer requires a non-const reference to the message in
order to construct.

In addition, the message-oriented async_write algorithm is
modified to support messages passed by const reference when
possible, based on the body writer attributes.
2018-05-06 19:57:25 -07:00
Vinnie Falco 416f84bc63 Remove deprecated Body reader and writer ctor signatures 2018-05-04 12:47:27 -07:00
Vinnie Falco 42ac536f9b Refactor HTTP write_op implementation
fix #764
2018-04-25 14:07:19 -07:00
Vinnie Falco 3c3f4fc52b Revert "Tidy up a warning"
This reverts commit 90d2df3be3.
2018-04-10 09:09:49 -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
Vinnie Falco 12cc10f8bb Revert "Tidy up calls to post()"
This reverts commit 5eaa2be85e.
2018-03-22 20:13:39 -07:00
Vinnie Falco 90d2df3be3 Tidy up a warning 2018-03-11 14:22:50 -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