212 Commits
Author SHA1 Message Date
Michael Haubenschild 31a1fb332a Fix missing check for error code after header is parsed:
The missing error check leads to completely ignoring the body limit,
as the body limit is compared to the "Content-Length" header inside
the "finish_header" method.

closes #2201
2021-03-25 15:04:12 +01:00
Richard Hodges 670f01f050 No undefined behaviour in parser
closes #2172
2021-03-03 19:22:13 +01:00
Richard Hodges bea31bfff6 Fix nullptr implicit cast on fields::set()
fixes #2085
2020-09-13 16:19:27 +02:00
Richard Hodges 91d9457ab9 Add Sec-* HTTP headers
fixes #2080
closes #2082
2020-09-07 17:26:34 +02:00
Richard Hodges 9e6822773e Fix erroneous error when HTTP body_limit is none
fixes #2070
closes #2073
2020-08-28 13:26:59 +02:00
Christopher Kohlhoff 11385141ea Add handler tracking locations to http operations 2020-08-28 13:26:21 +02:00
Richard Hodges 2efb729c53 Fix compile errors under Clang 3.4
fixes #2030
closes #2031
2020-07-24 13:59:49 +02:00
Richard Hodges 14c3d50b57 Deprecate string_param (API Change):
API Changes:

`string_param`, which was previously the argument type when setting field values
has been replaced by `string_view`. Because of this, it is no longer possible to
set message field values directly as integrals.

Users are required to convert numeric arguments to a string type prior to calling
`fields::set` et. al.

Beast provides the non-allocating `to_static_string()` function for this purpose.

To set Content-Length field manually, call `message::content_length`.

fixes #1956
2020-06-12 17:33:20 +02:00
Richard Hodges 0fdf9cb4df Parser body_limit is optional (API Change):
API Changes:

The signature of basic_parser<>::body_limit(n) has changed. It now accepts an
optional std::uint64_t. The caller may indicate that no body limit is required
by calling body_limit(boost::none). The default limits remain in place in order
to maintain 'safe by default' behaviour.

closes #1897
closes #1965
2020-05-29 20:28:22 +02:00
Richard Hodges 1054661723 Fix http read bytes_transferred (API Change)
fixes #1942
2020-05-20 15:54:52 +02:00
Richard Hodges 638e2d1244 Fix compilation errors with msvc /std:c++latest
fixes #1916
fixes #1925
2020-05-01 07:08:31 +02:00
Richard Hodges fda558e034 Fix standalone compilation error with std::string_view
fixes #1913
2020-04-30 21:00:00 +02:00
Richard Hodges a4b5cd8473 Fix c++20 deprecation warning in span_body
resolves #1924
2020-04-30 16:54:27 +02:00
Richard Hodges d12dcef52c Fix Content-Length parsing
Fix #1880
2020-03-19 16:21:29 +01:00
Vinnie Falco f5273300f9 Field digest is endian-independent:
fix #1863
close #1864

* Added some comments
* Add 64-bit specific calculation
* Fix endian-dependence in digest
2020-02-29 10:43:05 -08:00
Vinnie Falco 18ce21d5c9 Translate some win32 errors to net error codes
fix #1815
2020-02-04 19:42:06 +01:00
Richard Hodges 7701bf8738 moved-from container with unequal allocator will not be modified:
Affects:
- flat_buffer
- multi_buffer
- http::fields

fixes #1832
closes #1834
2020-02-04 18:36:53 +01:00
Richard Hodges 6d10adf936 fix erase field
fixes #1828
closes #1829
2020-02-04 18:36:50 +01:00
Richard Hodges 3d168c0336 file body reports short_read on eof
fixes #1818
fixes #1815
close #1821
2020-01-28 10:24:44 +01:00
Mika Fischer a6155ae9bf Add accessor function to File member of basic_file_body:
fix #1260
close #1814
2020-01-23 16:24:46 +01:00
Mika Fischer 0abb38a310 file_win32 bodies respect http::serializer::split
fix #1786, close #1788
2019-12-23 10:51:22 -08:00
Vinnie Falco 32bbd38387 Support Concepts for completion token params 2019-10-31 06:47:22 -07:00
Vinnie Falco 9f468ec1c1 Use automatically deduced return types for all async operations:
C++14 or later is required to support completion tokens that use
per-operation return type deduction. For C++11, a completion
token's async_result specialisation must still provide the nested
typedef `return_type`.
2019-10-31 06:47:22 -07:00
Vinnie Falco 7cc8759261 Async init-fns use the executor's default token 2019-10-31 05:47:05 -07:00
Peter Jankuliak 1abe92f524 Fix leftovers in basic_parser corner case:
fix #1734, close #1736

buf_.get() has size `buf_len_`, but only `size` number of octets in that
buffer is valid.
2019-10-18 05:30:29 -07:00
Vinnie Falco 0f932d589b Silence unused variables 2019-10-04 18:57:48 -07:00
Vinnie Falco f3118b75de Fix /permissive- missing include
fix #1673
2019-09-27 06:46:02 -07:00
Damian Jarek c1565e1ff7 Fix missing initializer warning in basic_fields
clang complains about missing initializer (even though the field was
properly initialized by the default constructor).

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2019-07-08 20:28:58 +02:00
Damian Jarek 63ef7f65bc Handle overflow in max size calculation in basic_dynamic_body
fix #1581

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2019-07-08 20:28:49 +02:00
Vinnie Falco d5cd3e829b Don't over-allocate in http::basic_fields 2019-07-01 12:49:03 -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 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 50ce5f7396 More split compilation in rfc7230.hpp
* Moved `find` and `exists` to the `ipp` file.
* Fixed missing include file in MSVC.

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2019-06-23 09:50:16 +02:00
Damian Jarek f10dc38ae6 Replace uses of net::coroutine with asio::coroutine
`asio::coroutine` is an extension, which is not part of
the Networking TS, so the `net` alias is not appropriate in this case.

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2019-06-19 17:53:35 +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 da61b4e52c Move char_buffer into a separate file
Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2019-06-19 17:53:34 +02:00
Damian Jarek d5f5f1467f Enable split compilation in http::basic_fields
Moved functions,that are independent of template argument, into
an *.ipp file.

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2019-06-19 17:53:33 +02:00
Damian Jarek 833243d948 Remove the use of static_string from http::fields
The `temporary_buffer<A>` class template replaces the use of
`static_string` in `http::fields`, simplifying `set_chunked_impl` and
`set_keep_alive_impl`.

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2019-06-04 15:31:18 +02:00
Damian Jarek 76842d637f Reduce the number of instantiations of filter_token_list
Not using lambdas in this case reduced the number of instantiations of
the algorithm by a factor of 4x at no (observable) runtime cost.

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2019-06-03 18:05:52 +02:00
Vinnie Falco be460675bc Preserve operation_aborted on partial message 2019-05-20 15:34:22 +02:00
Damian Jarek c254b4fcfb Remove uses of the deprecated buffers function
Fix: 1607
Close: 1608

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2019-05-19 22:32:37 +02:00
Damian Jarek 45aaf22acd Relax requirements for vector_body:
fix: #1567

std::byte is not an arithmetic type, which caused compilation to fail
when it was used in vector_body.

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2019-04-20 10:19:31 -07:00
Vinnie Falco 71de05d3cc More std::string_view fixes 2019-04-18 16:15:42 -07:00
Damian Jarek 2cfe3ba1b8 Replace static_string in parser
close #1574

This change yields a modest performance improment of 1-2% by replacing
the exception-based handling of buffer overflow with one based on
regular conditional checks.

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2019-04-15 08:21:48 -07:00
Damian Jarek b7a8fb5178 Fix compilation on MSVC with std::string_view
close #1573

std::string_view::iterator is not necessarily a raw pointer.

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2019-04-15 08:21:48 -07:00
Mohamed El Housseine ebe52537ea Set parser status and flags even if body_limit_ has been reached
close #1556
2019-04-08 17:14:46 -07:00
Denis Glazachev 058294e908 Fix http::message constructor constraint 2019-03-30 14:14:59 -07:00
Denis Glazachev 24ccdd243a Fix some typos 2019-03-30 11:12:04 -07:00
Vinnie Falco a7faf03694 Fix http::message constructor constraint 2019-03-29 20:42:44 -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