Skip to content

Commit

Permalink
Merge branch 'boostorg:develop' into zig-pkg
Browse files Browse the repository at this point in the history
  • Loading branch information
kassane authored Feb 15, 2024
2 parents 29c1a76 + e42cf8a commit 09330f8
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 77 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,6 @@ class session : public std::enable_shared_from_this<session>
if(ec)
return fail(ec, "connect");

// Update the host_ string. This will provide the value of the
// Host HTTP header during the WebSocket handshake.
// See https://tools.ietf.org/html/rfc7230#section-5.4
host_ += ':' + std::to_string(ep.port());

// Set a timeout on the operation
beast::get_lowest_layer(ws_).expires_after(std::chrono::seconds(30));

Expand All @@ -132,6 +127,11 @@ class session : public std::enable_shared_from_this<session>
return fail(ec, "connect");
}

// Update the host_ string. This will provide the value of the
// Host HTTP header during the WebSocket handshake.
// See https://tools.ietf.org/html/rfc7230#section-5.4
host_ += ':' + std::to_string(ep.port());

// Perform the SSL handshake
ws_.next_layer().async_handshake(
ssl::stream_base::client,
Expand Down
5 changes: 0 additions & 5 deletions include/boost/beast/core/string_type.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,7 @@
#define BOOST_BEAST_STRING_TYPE_HPP

#include <boost/beast/core/detail/config.hpp>

#include <boost/core/detail/string_view.hpp>
#if defined(BOOST_BEAST_USE_STD_STRING_VIEW)
#include <boost/config/pragma_message.hpp>
BOOST_PRAGMA_MESSAGE("BOOST_BEAST_USE_STD_STRING_VIEW is deprecated, use BOOST_NO_CXX17_HDR_STRING_VIEW instead");
#endif

namespace boost {
namespace beast {
Expand Down
93 changes: 30 additions & 63 deletions include/boost/beast/http/read.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,9 @@ namespace http {
@param parser The parser to use.
@return The number of bytes transferred from the stream.
@return The number of bytes consumed by the parser.
@throws system_error Thrown on failure.
@note The function returns the total number of bytes transferred from the
stream. This may be zero for the case where there is sufficient pre-existing
message data in the dynamic buffer.
*/
template<
class SyncReadStream,
Expand Down Expand Up @@ -121,11 +117,7 @@ read_some(
@param ec Set to the error, if any occurred.
@return The number of bytes transferred from the stream.
@note The function returns the total number of bytes transferred from the
stream. This may be zero for the case where there is sufficient pre-existing
message data in the dynamic buffer.
@return The number of bytes consumed by the parser.
*/
template<
class SyncReadStream,
Expand Down Expand Up @@ -189,7 +181,7 @@ read_some(
@code
void handler(
error_code const& error, // result of operation
std::size_t bytes_transferred // the total number of bytes transferred from the stream
std::size_t bytes_transferred // the number of bytes consumed by the parser
);
@endcode
If the handler has an associated immediate executor,
Expand All @@ -198,10 +190,6 @@ read_some(
this function. Invocation of the handler will be performed in a
manner equivalent to using `net::post`.
@note The completion handler will receive as a parameter the total number
of bytes transferred from the stream. This may be zero for the case where
there is sufficient pre-existing message data in the dynamic buffer.
@par Per-Operation Cancellation
This asynchronous operation supports cancellation for the following
Expand Down Expand Up @@ -270,14 +258,12 @@ async_read_some(
@param parser The parser to use.
@return The number of bytes transferred from the stream.
@return The number of bytes consumed by the parser.
@throws system_error Thrown on failure.
@note The function returns the total number of bytes transferred from the
stream. This may be zero for the case where there is sufficient pre-existing
message data in the dynamic buffer. The implementation will call
@ref basic_parser::eager with the value `false` on the parser passed in.
@note The implementation will call @ref basic_parser::eager with the value
`false` on the parser passed in.
*/
template<
class SyncReadStream,
Expand Down Expand Up @@ -329,12 +315,10 @@ read_header(
@param ec Set to the error, if any occurred.
@return The number of bytes transferred from the stream.
@return The number of bytes consumed by the parser.
@note The function returns the total number of bytes transferred from the
stream. This may be zero for the case where there is sufficient pre-existing
message data in the dynamic buffer. The implementation will call
@ref basic_parser::eager with the value `false` on the parser passed in.
@note The implementation will call @ref basic_parser::eager with the value
`false` on the parser passed in.
*/
template<
class SyncReadStream,
Expand Down Expand Up @@ -397,7 +381,7 @@ read_header(
@code
void handler(
error_code const& error, // result of operation
std::size_t bytes_transferred // the total number of bytes transferred from the stream
std::size_t bytes_transferred // the number of bytes consumed by the parser
);
@endcode
If the handler has an associated immediate executor,
Expand All @@ -406,11 +390,8 @@ read_header(
this function. Invocation of the handler will be performed in a
manner equivalent to using `net::post`.
@note The completion handler will receive as a parameter the total number
of bytes transferred from the stream. This may be zero for the case where
there is sufficient pre-existing message data in the dynamic buffer. The
implementation will call @ref basic_parser::eager with the value `false`
on the parser passed in.
@note The implementation will call @ref basic_parser::eager with the value
`false` on the parser passed in.
@par Per-Operation Cancellation
Expand Down Expand Up @@ -480,14 +461,12 @@ async_read_header(
@param parser The parser to use.
@return The number of bytes transferred from the stream.
@return The number of bytes consumed by the parser.
@throws system_error Thrown on failure.
@note The function returns the total number of bytes transferred from the
stream. This may be zero for the case where there is sufficient pre-existing
message data in the dynamic buffer. The implementation will call
@ref basic_parser::eager with the value `true` on the parser passed in.
@note The implementation will call @ref basic_parser::eager with the value
`true` on the parser passed in.
*/
template<
class SyncReadStream,
Expand Down Expand Up @@ -539,12 +518,10 @@ read(
@param ec Set to the error, if any occurred.
@return The number of bytes transferred from the stream.
@return The number of bytes consumed by the parser.
@note The function returns the total number of bytes transferred from the
stream. This may be zero for the case where there is sufficient pre-existing
message data in the dynamic buffer. The implementation will call
@ref basic_parser::eager with the value `true` on the parser passed in.
@note The implementation will call @ref basic_parser::eager with the value
`true` on the parser passed in.
*/
template<
class SyncReadStream,
Expand Down Expand Up @@ -607,7 +584,7 @@ read(
@code
void handler(
error_code const& error, // result of operation
std::size_t bytes_transferred // the total number of bytes transferred from the stream
std::size_t bytes_transferred // the number of bytes consumed by the parser
);
@endcode
If the handler has an associated immediate executor,
Expand All @@ -616,11 +593,8 @@ read(
this function. Invocation of the handler will be performed in a
manner equivalent to using `net::post`.
@note The completion handler will receive as a parameter the total number
of bytes transferred from the stream. This may be zero for the case where
there is sufficient pre-existing message data in the dynamic buffer. The
implementation will call @ref basic_parser::eager with the value `true`
on the parser passed in.
@note The implementation will call @ref basic_parser::eager with the value
`true` on the parser passed in.
@par Per-Operation Cancellation
Expand Down Expand Up @@ -693,14 +667,12 @@ async_read(
is undefined. The type must be meet the <em>MoveAssignable</em> and
<em>MoveConstructible</em> requirements.
@return The number of bytes transferred from the stream.
@return The number of bytes consumed by the parser.
@throws system_error Thrown on failure.
@note The function returns the total number of bytes transferred from the
stream. This may be zero for the case where there is sufficient pre-existing
message data in the dynamic buffer. The implementation will call
@ref basic_parser::eager with the value `true` on the parser passed in.
@note The implementation will call @ref basic_parser::eager with the value
`true` on the parser passed in.
*/
template<
class SyncReadStream,
Expand Down Expand Up @@ -755,12 +727,10 @@ read(
@param ec Set to the error, if any occurred.
@return The number of bytes transferred from the stream.
@return The number of bytes consumed by the parser.
@note The function returns the total number of bytes transferred from the
stream. This may be zero for the case where there is sufficient pre-existing
message data in the dynamic buffer. The implementation will call
@ref basic_parser::eager with the value `true` on the parser passed in.
@note The implementation will call @ref basic_parser::eager with the value
`true` on the parser passed in.
*/
template<
class SyncReadStream,
Expand Down Expand Up @@ -826,7 +796,7 @@ read(
@code
void handler(
error_code const& error, // result of operation
std::size_t bytes_transferred // the total number of bytes transferred from the stream
std::size_t bytes_transferred // the number of bytes consumed by the parser
);
@endcode
If the handler has an associated immediate executor,
Expand All @@ -835,11 +805,8 @@ read(
this function. Invocation of the handler will be performed in a
manner equivalent to using `net::post`.
@note The completion handler will receive as a parameter the total number
of bytes transferred from the stream. This may be zero for the case where
there is sufficient pre-existing message data in the dynamic buffer. The
implementation will call @ref basic_parser::eager with the value `true`
on the parser passed in.
@note The implementation will call @ref basic_parser::eager with the value
`true` on the parser passed in.
@par Per-Operation Cancellation
Expand Down
28 changes: 26 additions & 2 deletions include/boost/beast/http/serializer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ namespace http {
the chunk buffer sequence types @ref chunk_body, @ref chunk_crlf,
@ref chunk_header, and @ref chunk_last.
@note
Moving or copying the serializer after the first call to
@ref serializer::next results in undefined behavior. Try to heap-allocate
the serializer object if you need to move the serializer between multiple
async operations (for example, between a call to `async_write_header` and
`async_write`).
@tparam isRequest `true` if the message is a request.
@tparam Body The body type of the message.
Expand Down Expand Up @@ -189,10 +197,26 @@ class serializer
bool more_ = false;

public:
/// Constructor
/** Move Constructor
@note
Moving or copying the serializer after the first call to
@ref serializer::next results in undefined behavior. Try to heap-allocate
the serializer object if you need to move the serializer between multiple
async operations (for example, between a call to `async_write_header` and
`async_write`).
*/
serializer(serializer&&) = default;

/// Constructor
/** Copy Constructor
@note
Moving or copying the serializer after the first call to
@ref serializer::next results in undefined behavior. Try to heap-allocate
the serializer object if you need to move the serializer between multiple
async operations (for example, between a call to `async_write_header` and
`async_write`).
*/
serializer(serializer const&) = default;

/// Assignment
Expand Down
9 changes: 7 additions & 2 deletions include/boost/beast/websocket/option.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,13 @@ namespace websocket {
These settings control the permessage-deflate extension,
which allows messages to be compressed.
@note Objects of this type are used with
@ref beast::websocket::stream::set_option.
@note
These settings should be configured before performing the WebSocket
handshake.
Objects of this type are used with
@ref beast::websocket::stream::set_option.
*/
struct permessage_deflate
{
Expand Down
5 changes: 5 additions & 0 deletions include/boost/beast/websocket/stream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,11 @@ class stream
@throws invalid_argument if `deflateSupported == false`, and either
`client_enable` or `server_enable` is `true`.
@note
These settings should be configured before performing the WebSocket
handshake.
*/
void
set_option(permessage_deflate const& o);
Expand Down

0 comments on commit 09330f8

Please sign in to comment.