10 #ifndef BOOST_BEAST_WEBSOCKET_DETAIL_PMD_EXTENSION_HPP 11 #define BOOST_BEAST_WEBSOCKET_DETAIL_PMD_EXTENSION_HPP 20 #include <boost/asio/buffer.hpp> 50 template<
class =
void>
58 if(s[0] <
'1' || s[0] >
'9')
63 if(c < '0' || c >
'9')
66 i = 10 * i + (c -
'0');
70 return static_cast<int>(i);
75 template<
class Allocator>
87 fields[
"Sec-WebSocket-Extensions"]};
88 for(
auto const& ext : list)
90 if(
iequals(ext.first,
"permessage-deflate"))
92 for(
auto const& param : ext.second)
95 "server_max_window_bits"))
104 if(param.second.empty())
123 "client_max_window_bits"))
132 if(! param.second.empty())
151 "server_no_context_takeover"))
160 if(! param.second.empty())
170 "client_no_context_takeover"))
179 if(! param.second.empty())
204 template<
class Allocator>
210 s =
"permessage-deflate";
215 s +=
"; server_max_window_bits=";
221 s +=
"; server_max_window_bits";
228 s +=
"; client_max_window_bits=";
234 s +=
"; client_max_window_bits";
239 s +=
"; server_no_context_takeover";
243 s +=
"; client_no_context_takeover";
250 template<
class Allocator>
271 s +=
"; server_no_context_takeover";
277 s +=
"; client_no_context_takeover";
294 s +=
"; server_max_window_bits=";
307 s +=
"; client_max_window_bits=";
332 s +=
"; client_max_window_bits=";
363 template<
class DeflateStream,
class ConstBufferSequence>
367 boost::asio::mutable_buffer& out,
370 std::size_t& total_in,
373 using boost::asio::buffer;
374 using boost::asio::buffer_cast;
375 using boost::asio::buffer_size;
376 BOOST_ASSERT(buffer_size(out) >= 6);
381 zs.
next_out = buffer_cast<
void*>(out);
382 for(boost::asio::const_buffer in : cb)
387 zs.
next_in = buffer_cast<
void const*>(in);
394 BOOST_ASSERT(zs.
total_out == buffer_size(out));
395 ec.assign(0, ec.category());
400 BOOST_ASSERT(zs.
total_out == buffer_size(out));
409 auto const remain = buffer_size(cb);
420 ec.assign(0, ec.category());
435 ec.assign(0, ec.category());
int server_max_window_bits
Definition: pmd_extension.hpp:38
static_string< detail::max_digits(sizeof(Integer))> to_static_string(Integer x)
Definition: static_string.ipp:598
int client_max_window_bits
Definition: pmd_extension.hpp:41
Definition: async_result.hpp:20
int client_max_window_bits
Definition: option.hpp:54
std::size_t total_out
Definition: zlib.hpp:107
Definition: option.hpp:36
Definition: consuming_buffers.hpp:40
int server_max_window_bits
Definition: option.hpp:48
Definition: config.hpp:10
bool server_no_context_takeover
Definition: pmd_extension.hpp:44
bool client_no_context_takeover
true if client_no_context_takeover desired
Definition: option.hpp:60
bool server_enable
true to offer the extension in the server role
Definition: option.hpp:39
Definition: rfc7230.hpp:141
std::size_t total_in
Definition: zlib.hpp:95
boost::system::error_code error_code
The type of error code used by the library.
Definition: error.hpp:21
Definition: fields.hpp:53
void pmd_normalize(pmd_offer &offer)
Definition: pmd_extension.hpp:345
void const * next_in
Definition: zlib.hpp:85
void pmd_write(http::basic_fields< Allocator > &fields, pmd_offer const &offer)
Definition: pmd_extension.hpp:206
Definition: pmd_extension.hpp:33
bool server_no_context_takeover
true if server_no_context_takeover desired
Definition: option.hpp:57
void * next_out
Definition: zlib.hpp:99
int parse_bits(string_view s)
Definition: pmd_extension.hpp:52
bool deflate(DeflateStream &zo, boost::asio::mutable_buffer &out, consuming_buffers< ConstBufferSequence > &cb, bool fin, std::size_t &total_in, error_code &ec)
Definition: pmd_extension.hpp:365
bool iequals(beast::string_view lhs, beast::string_view rhs)
Definition: string.hpp:107
void pmd_read(pmd_offer &offer, http::basic_fields< Allocator > const &fields)
Definition: pmd_extension.hpp:77
std::size_t avail_out
Definition: zlib.hpp:103
bool client_no_context_takeover
Definition: pmd_extension.hpp:47
boost::string_ref string_view
The type of string view used by the library.
Definition: string.hpp:36
std::size_t avail_in
Definition: zlib.hpp:91
bool accept
Definition: pmd_extension.hpp:35
void pmd_negotiate(http::basic_fields< Allocator > &fields, pmd_offer &config, pmd_offer const &offer, permessage_deflate const &o)
Definition: pmd_extension.hpp:252
Definition: static_string.hpp:44
basic_fields< std::allocator< char >> fields
A typical HTTP header fields container.
Definition: fields.hpp:740
void set(field name, string_param const &value)
Definition: fields.ipp:587