mirror of
https://github.com/boostorg/beast.git
synced 2025-08-03 14:54:32 +02:00
Fixes for websocket echo server:
* Decorator members are const * Enable permessage-deflate extension
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
1.0.0-b25
|
||||||
|
|
||||||
|
* Fixes for WebSocket echo server
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
1.0.0-b24
|
1.0.0-b24
|
||||||
|
|
||||||
* bjam use clang on MACOSX
|
* bjam use clang on MACOSX
|
||||||
|
@@ -38,14 +38,14 @@ private:
|
|||||||
{
|
{
|
||||||
template<class Body, class Fields>
|
template<class Body, class Fields>
|
||||||
void
|
void
|
||||||
operator()(http::message<true, Body, Fields>& req)
|
operator()(http::message<true, Body, Fields>& req) const
|
||||||
{
|
{
|
||||||
req.fields.replace("User-Agent", "async_echo_client");
|
req.fields.replace("User-Agent", "async_echo_client");
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Body, class Fields>
|
template<class Body, class Fields>
|
||||||
void
|
void
|
||||||
operator()(http::message<false, Body, Fields>& resp)
|
operator()(http::message<false, Body, Fields>& resp) const
|
||||||
{
|
{
|
||||||
resp.fields.replace("Server", "async_echo_server");
|
resp.fields.replace("Server", "async_echo_server");
|
||||||
}
|
}
|
||||||
|
@@ -18,17 +18,22 @@ int main()
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
permessage_deflate pmd;
|
||||||
|
pmd.client_enable = true;
|
||||||
|
pmd.server_enable = true;
|
||||||
|
|
||||||
beast::error_code ec;
|
beast::error_code ec;
|
||||||
async_echo_server s1{nullptr, 1};
|
async_echo_server s1{nullptr, 1};
|
||||||
s1.open(endpoint_type{
|
s1.open(endpoint_type{
|
||||||
address_type::from_string("127.0.0.1"), 6000 }, ec);
|
address_type::from_string("127.0.0.1"), 6000 }, ec);
|
||||||
s1.set_option(read_message_max{64 * 1024 * 1024});
|
s1.set_option(read_message_max{64 * 1024 * 1024});
|
||||||
s1.set_option(auto_fragment{false});
|
s1.set_option(auto_fragment{false});
|
||||||
//s1.set_option(write_buffer_size{64 * 1024});
|
s1.set_option(pmd);
|
||||||
|
|
||||||
beast::websocket::sync_echo_server s2(&std::cout, endpoint_type{
|
beast::websocket::sync_echo_server s2(&std::cout, endpoint_type{
|
||||||
address_type::from_string("127.0.0.1"), 6001 });
|
address_type::from_string("127.0.0.1"), 6001 });
|
||||||
s2.set_option(read_message_max{64 * 1024 * 1024});
|
s2.set_option(read_message_max{64 * 1024 * 1024});
|
||||||
|
s2.set_option(pmd);
|
||||||
|
|
||||||
beast::test::sig_wait();
|
beast::test::sig_wait();
|
||||||
}
|
}
|
||||||
|
@@ -36,14 +36,14 @@ private:
|
|||||||
{
|
{
|
||||||
template<class Body, class Fields>
|
template<class Body, class Fields>
|
||||||
void
|
void
|
||||||
operator()(http::message<true, Body, Fields>& req)
|
operator()(http::message<true, Body, Fields>& req) const
|
||||||
{
|
{
|
||||||
req.fields.replace("User-Agent", "sync_echo_client");
|
req.fields.replace("User-Agent", "sync_echo_client");
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Body, class Fields>
|
template<class Body, class Fields>
|
||||||
void
|
void
|
||||||
operator()(http::message<false, Body, Fields>& resp)
|
operator()(http::message<false, Body, Fields>& resp) const
|
||||||
{
|
{
|
||||||
resp.fields.replace("Server", "sync_echo_server");
|
resp.fields.replace("Server", "sync_echo_server");
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user