218 Commits

Author SHA1 Message Date
alandefreitas
eaa51201bd Fix broken links
fix #2333
2022-06-22 15:07:30 -03:00
alandefreitas
3272dc0aeb Document fields::equal_range
fix #1251
2022-06-22 15:06:39 -03:00
Petre Pircalabu
7f6adb91f7 Fix large files transfer on Windows
The maximum number of bytes to write using TransmitFile cannot be
greater than INT_MAX - 1, otherwise the function fails with WSAEINVAL.

https://docs.microsoft.com/en-us/windows/win32/api/mswsock/nf-mswsock-transmitfile

The issue can be reproduced using the http-server-sync example, by
sending a GET request for a file larger than INTMAX.

e.g:
$ curl -v http://127.0.0.1:8080/ubuntu.iso -o ubuntu.iso
*   Trying 127.0.0.1:8080...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> GET /ubuntu.iso HTTP/1.1
> Host: 127.0.0.1:8080
> User-Agent: curl/7.83.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Server: Boost.Beast/330
< Content-Type: application/text
< Content-Length: 3654957056
<
{ [0 bytes data]
* transfer closed with 3654957056 bytes remaining to read
  0 3485M    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
* Closing connection 0
curl: (18) transfer closed with 3654957056 bytes remaining to read

Signed-off-by: Petre Pircalabu <ppircalabu@bitdefender.com>
2022-06-21 20:37:43 -03:00
sehe
740879a995 Add http::message_generator 2022-05-21 22:12:13 -07:00
sehe
344c10ff1e serializer::is_done is const 2022-05-21 22:12:13 -07:00
Glen Fernandes
24275ac0c6 Use static_string from Boost.StaticString 2022-04-17 12:30:52 -04:00
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