forked from boostorg/beast
Avoid std::string in websocket
This commit is contained in:
@@ -4,6 +4,7 @@ Version 58:
|
|||||||
* Qualify size_t in message template
|
* Qualify size_t in message template
|
||||||
* Reorganize examples
|
* Reorganize examples
|
||||||
* Specification for http read
|
* Specification for http read
|
||||||
|
* Avoid `std::string` in websocket
|
||||||
|
|
||||||
API Changes:
|
API Changes:
|
||||||
|
|
||||||
|
@@ -200,14 +200,14 @@ template<class Fields>
|
|||||||
void
|
void
|
||||||
pmd_write(Fields& fields, pmd_offer const& offer)
|
pmd_write(Fields& fields, pmd_offer const& offer)
|
||||||
{
|
{
|
||||||
std::string s;
|
static_string<512> s;
|
||||||
s = "permessage-deflate";
|
s = "permessage-deflate";
|
||||||
if(offer.server_max_window_bits != 0)
|
if(offer.server_max_window_bits != 0)
|
||||||
{
|
{
|
||||||
if(offer.server_max_window_bits != -1)
|
if(offer.server_max_window_bits != -1)
|
||||||
{
|
{
|
||||||
s += "; server_max_window_bits=";
|
s += "; server_max_window_bits=";
|
||||||
s += std::to_string(
|
s += to_static_string(
|
||||||
offer.server_max_window_bits);
|
offer.server_max_window_bits);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -220,7 +220,7 @@ pmd_write(Fields& fields, pmd_offer const& offer)
|
|||||||
if(offer.client_max_window_bits != -1)
|
if(offer.client_max_window_bits != -1)
|
||||||
{
|
{
|
||||||
s += "; client_max_window_bits=";
|
s += "; client_max_window_bits=";
|
||||||
s += std::to_string(
|
s += to_static_string(
|
||||||
offer.client_max_window_bits);
|
offer.client_max_window_bits);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -256,7 +256,7 @@ pmd_negotiate(
|
|||||||
}
|
}
|
||||||
config.accept = true;
|
config.accept = true;
|
||||||
|
|
||||||
std::string s = "permessage-deflate";
|
static_string<512> s = "permessage-deflate";
|
||||||
|
|
||||||
config.server_no_context_takeover =
|
config.server_no_context_takeover =
|
||||||
offer.server_no_context_takeover ||
|
offer.server_no_context_takeover ||
|
||||||
@@ -286,7 +286,7 @@ pmd_negotiate(
|
|||||||
config.server_max_window_bits = 9;
|
config.server_max_window_bits = 9;
|
||||||
|
|
||||||
s += "; server_max_window_bits=";
|
s += "; server_max_window_bits=";
|
||||||
s += std::to_string(
|
s += to_static_string(
|
||||||
config.server_max_window_bits);
|
config.server_max_window_bits);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -299,7 +299,7 @@ pmd_negotiate(
|
|||||||
if(config.client_max_window_bits < 15)
|
if(config.client_max_window_bits < 15)
|
||||||
{
|
{
|
||||||
s += "; client_max_window_bits=";
|
s += "; client_max_window_bits=";
|
||||||
s += std::to_string(
|
s += to_static_string(
|
||||||
config.client_max_window_bits);
|
config.client_max_window_bits);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -324,7 +324,7 @@ pmd_negotiate(
|
|||||||
o.client_max_window_bits,
|
o.client_max_window_bits,
|
||||||
offer.client_max_window_bits);
|
offer.client_max_window_bits);
|
||||||
s += "; client_max_window_bits=";
|
s += "; client_max_window_bits=";
|
||||||
s += std::to_string(
|
s += to_static_string(
|
||||||
config.client_max_window_bits);
|
config.client_max_window_bits);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user