enable server initiated s2c_no_context_takeover

This commit is contained in:
Peter Thorson
2013-06-27 19:02:28 -05:00
parent c7b1ddd9fa
commit 9749c0a3d5
2 changed files with 36 additions and 0 deletions

View File

@@ -114,3 +114,13 @@ BOOST_AUTO_TEST_CASE( negotiate_s2c_no_context_takeover ) {
BOOST_CHECK_EQUAL( v.esp.first, websocketpp::lib::error_code() );
BOOST_CHECK_EQUAL( v.esp.second, "permessage-deflate; s2c_no_context_takeover");
}
BOOST_AUTO_TEST_CASE( negotiate_s2c_no_context_takeover_server_initiated ) {
ext_vars v;
v.exts.enable_s2c_no_context_takeover();
v.esp = v.exts.negotiate(v.attr);
BOOST_CHECK( v.exts.is_enabled() );
BOOST_CHECK_EQUAL( v.esp.first, websocketpp::lib::error_code() );
BOOST_CHECK_EQUAL( v.esp.second, "permessage-deflate; s2c_no_context_takeover");
}

View File

@@ -198,6 +198,32 @@ public:
return false;
}
/// Reset server's outgoing LZ77 sliding window for each new message
/**
* Enabling this setting will cause the server's compressor to reset the
* compression state (the LZ77 sliding window) for every message. This
* means that the compressor will not look back to patterns in previous
* messages to improve compression. This will reduce the compression
* efficiency for large messages somewhat and small messages drastically.
*
* This option may reduce server compressor memory usage and client
* decompressor memory usage.
* @todo Document to what extent memory usage will be reduced
*
* For clients, this option is dependent on server support. Enabling it
* via this method does not guarantee that it will be successfully
* negotiated, only that it will be requested.
*
* For servers, no client support is required. Enabling this option on a
* server will result in its use. The server will signal to clients that
* the option will be in use so they can optimize resource usage if they
* are able.
*/
void enable_s2c_no_context_takeover() {
m_s2c_no_context_takeover = true;
}
/// Generate extension offer
/**
* Creates an offer string to include in the Sec-WebSocket-Extensions