Skip to content

Commit 1b54986

Browse files
committed
Sync from upstream.
2 parents 47e5fa0 + e7f4919 commit 1b54986

File tree

18 files changed

+288
-76
lines changed

18 files changed

+288
-76
lines changed

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
Version 354:
2+
3+
* `ssl_stream` and `flat_stream` are deprecated (Use `net::ssl::stream` instead)
4+
* `net::ssl::stream` is canonical in examples and snippets
5+
* `ssl_stream` does not use `flat_stream`
6+
* Add `SSL/TLS Shutdown Procedure` section to documentation
7+
* Add HTTP status code 418 ("I'm a teapot")
8+
* `websocket::stream::read_size_hint()` does not exceed read_message_max
9+
* Fix underflow of `bytes_transferred` in websocket partial write operations
10+
* Fix error handling of SSL/TLS shutdown operations in examples
11+
* Fix handling of expired timers in `basic_stream::ops::transfer_op`
12+
* Fix ambiguity in `test::basic_stream` constructor overloads
13+
* Fix partial parsing of the final chunk in `http::parser`
14+
* Fix dereferenced null pointer warning in `test::immediate_executor`
15+
* Fix warnings in tests
16+
* Fix OpenSSL builds in GHA CI and Drone CI
17+
* Fix `test::immediate_executor` type traits
18+
* Refactor Jamfiles to limit the scope of definitions
19+
* Expand CI matrix
20+
21+
--------------------------------------------------------------------------------
22+
123
Version 353:
224

325
* Fix unreachable code warning in `buffers_cat.hpp`

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ endfunction()
8383
#
8484
#-------------------------------------------------------------------------------
8585

86-
project (Beast VERSION 353)
86+
project (Beast VERSION 354)
8787

8888
set_property (GLOBAL PROPERTY USE_FOLDERS ON)
8989
option (Beast_BUILD_EXAMPLES "Build examples" ON)

include/boost/beast/http/fields.hpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,15 @@ class basic_fields
204204
using alloc_traits =
205205
beast::detail::allocator_traits<rebind_type>;
206206

207+
using pocma = typename
208+
alloc_traits::propagate_on_container_move_assignment;
209+
210+
using pocca = typename
211+
alloc_traits::propagate_on_container_copy_assignment;
212+
213+
using pocs = typename
214+
alloc_traits::propagate_on_container_swap;
215+
207216
using size_type = typename
208217
beast::detail::allocator_traits<Allocator>::size_type;
209218

@@ -265,7 +274,7 @@ class basic_fields
265274
as if constructed using the same allocator.
266275
*/
267276
basic_fields& operator=(basic_fields&&) noexcept(
268-
alloc_traits::propagate_on_container_move_assignment::value);
277+
pocma::value && std::is_nothrow_move_assignable<Allocator>::value);
269278

270279
/// Copy assignment.
271280
basic_fields& operator=(basic_fields const&);

include/boost/beast/http/impl/fields.hpp

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
#include <boost/beast/http/chunk_encode.hpp>
2424
#include <boost/core/exchange.hpp>
2525
#include <boost/throw_exception.hpp>
26-
#include <stdexcept>
27-
#include <string>
2826

2927
namespace boost {
3028
namespace beast {
@@ -434,15 +432,12 @@ template<class Allocator>
434432
auto
435433
basic_fields<Allocator>::
436434
operator=(basic_fields&& other) noexcept(
437-
alloc_traits::propagate_on_container_move_assignment::value)
438-
-> basic_fields&
435+
pocma::value && std::is_nothrow_move_assignable<Allocator>::value)
436+
-> basic_fields&
439437
{
440-
static_assert(is_nothrow_move_assignable<Allocator>::value,
441-
"Allocator must be noexcept assignable.");
442438
if(this == &other)
443439
return *this;
444-
move_assign(other, std::integral_constant<bool,
445-
alloc_traits:: propagate_on_container_move_assignment::value>{});
440+
move_assign(other, pocma{});
446441
return *this;
447442
}
448443

@@ -452,8 +447,7 @@ basic_fields<Allocator>::
452447
operator=(basic_fields const& other) ->
453448
basic_fields&
454449
{
455-
copy_assign(other, std::integral_constant<bool,
456-
alloc_traits::propagate_on_container_copy_assignment::value>{});
450+
copy_assign(other, pocca{});
457451
return *this;
458452
}
459453

@@ -653,8 +647,7 @@ void
653647
basic_fields<Allocator>::
654648
swap(basic_fields<Allocator>& other)
655649
{
656-
swap(other, std::integral_constant<bool,
657-
alloc_traits::propagate_on_container_swap::value>{});
650+
swap(other, pocs{});
658651
}
659652

660653
template<class Allocator>
@@ -1124,13 +1117,13 @@ basic_fields<Allocator>::
11241117
move_assign(basic_fields& other, std::true_type)
11251118
{
11261119
clear_all();
1120+
this->get() = std::move(other.get());
11271121
set_ = std::move(other.set_);
11281122
list_ = std::move(other.list_);
11291123
method_ = other.method_;
11301124
target_or_reason_ = other.target_or_reason_;
11311125
other.method_ = {};
11321126
other.target_or_reason_ = {};
1133-
this->get() = other.get();
11341127
}
11351128

11361129
template<class Allocator>

include/boost/beast/http/impl/status.ipp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ int_to_status(unsigned v)
7272
case status::unsupported_media_type:
7373
case status::range_not_satisfiable:
7474
case status::expectation_failed:
75+
case status::i_am_a_teapot:
7576
case status::misdirected_request:
7677
case status::unprocessable_entity:
7778
case status::locked:
@@ -178,6 +179,7 @@ obsolete_reason(status v)
178179
case status::unsupported_media_type: return "Unsupported Media Type";
179180
case status::range_not_satisfiable: return "Range Not Satisfiable";
180181
case status::expectation_failed: return "Expectation Failed";
182+
case status::i_am_a_teapot: return "I'm a teapot";
181183
case status::misdirected_request: return "Misdirected Request";
182184
case status::unprocessable_entity: return "Unprocessable Entity";
183185
case status::locked: return "Locked";

include/boost/beast/http/status.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ enum class status : unsigned
8080
unsupported_media_type = 415,
8181
range_not_satisfiable = 416,
8282
expectation_failed = 417,
83+
i_am_a_teapot = 418,
8384
misdirected_request = 421,
8485
unprocessable_entity = 422,
8586
locked = 423,

include/boost/beast/version.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
This is a simple integer that is incremented by one every
2121
time a set of code changes is merged to the develop branch.
2222
*/
23-
#define BOOST_BEAST_VERSION 353
23+
#define BOOST_BEAST_VERSION 354
2424

2525
// A string describing BOOST_BEAST_VERSION, that can be used in http headers.
2626
#define BOOST_BEAST_VERSION_STRING "Boost.Beast/" BOOST_STRINGIZE(BOOST_BEAST_VERSION)

include/boost/beast/websocket/detail/impl_base.hpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,8 +311,9 @@ struct impl_base<true>
311311
read_size_hint_pmd(
312312
std::size_t initial_size,
313313
bool rd_done,
314+
std::uint64_t rd_msg_max,
314315
std::uint64_t rd_remain,
315-
detail::frame_header const& rd_fh) const
316+
frame_header const& rd_fh) const
316317
{
317318
using beast::detail::clamp;
318319
std::size_t result;
@@ -339,6 +340,9 @@ struct impl_base<true>
339340
initial_size, clamp(rd_remain));
340341
done:
341342
BOOST_ASSERT(result != 0);
343+
// Ensure offered size does not exceed rd_msg_max
344+
if(rd_msg_max)
345+
result = clamp(result, rd_msg_max);
342346
return result;
343347
}
344348
};
@@ -461,6 +465,7 @@ struct impl_base<false>
461465
read_size_hint_pmd(
462466
std::size_t initial_size,
463467
bool rd_done,
468+
std::uint64_t rd_msg_max,
464469
std::uint64_t rd_remain,
465470
frame_header const& rd_fh) const
466471
{
@@ -485,6 +490,9 @@ struct impl_base<false>
485490
initial_size, clamp(rd_remain));
486491
}
487492
BOOST_ASSERT(result != 0);
493+
// Ensure offered size does not exceed rd_msg_max
494+
if(rd_msg_max)
495+
result = clamp(result, rd_msg_max);
488496
return result;
489497
}
490498
};

include/boost/beast/websocket/impl/read.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -986,7 +986,7 @@ read_some(
986986
if(! limit)
987987
limit = (std::numeric_limits<std::size_t>::max)();
988988
auto const size =
989-
clamp(read_size_hint(buffer), limit);
989+
clamp(impl_->read_size_hint_db(buffer), limit);
990990
BOOST_ASSERT(size > 0);
991991
auto mb = beast::detail::dynamic_buffer_prepare(
992992
buffer, size, ec, error::buffer_overflow);

include/boost/beast/websocket/impl/stream.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ read_size_hint(
133133
std::size_t initial_size) const
134134
{
135135
return impl_->read_size_hint_pmd(
136-
initial_size, impl_->rd_done,
136+
initial_size, impl_->rd_done, impl_->rd_msg_max,
137137
impl_->rd_remain, impl_->rd_fh);
138138
}
139139

0 commit comments

Comments
 (0)