Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions ixwebsocket/IXWebSocketPerMessageDeflateOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ namespace ix
bool clientNoContextTakeover,
bool serverNoContextTakeover,
uint8_t clientMaxWindowBits,
uint8_t serverMaxWindowBits)
uint8_t serverMaxWindowBits,
bool sendClientServerMaxWindowBits)
{
_enabled = enabled;
_clientNoContextTakeover = clientNoContextTakeover;
_serverNoContextTakeover = serverNoContextTakeover;
_clientMaxWindowBits = clientMaxWindowBits;
_serverMaxWindowBits = serverMaxWindowBits;
_sendClientServerMaxWindowBits = sendClientServerMaxWindowBits;

sanitizeClientMaxWindowBits();
}
Expand All @@ -59,6 +61,7 @@ namespace ix
_enabled = false;
_clientNoContextTakeover = false;
_serverNoContextTakeover = false;
_sendClientServerMaxWindowBits = true;
_clientMaxWindowBits = kDefaultClientMaxWindowBits;
_serverMaxWindowBits = kDefaultServerMaxWindowBits;

Expand Down Expand Up @@ -128,8 +131,11 @@ namespace ix
if (_clientNoContextTakeover) ss << "; client_no_context_takeover";
if (_serverNoContextTakeover) ss << "; server_no_context_takeover";

ss << "; server_max_window_bits=" << static_cast<int>(_serverMaxWindowBits);
ss << "; client_max_window_bits=" << static_cast<int>(_clientMaxWindowBits);
if (_sendClientServerMaxWindowBits)
{
ss << "; server_max_window_bits=" << static_cast<int>(_serverMaxWindowBits);
ss << "; client_max_window_bits=" << static_cast<int>(_clientMaxWindowBits);
}

ss << "\r\n";

Expand Down Expand Up @@ -168,6 +174,11 @@ namespace ix
return _serverMaxWindowBits;
}

bool WebSocketPerMessageDeflateOptions::getSendClientServerMaxWindowBits() const
{
return _sendClientServerMaxWindowBits;
}

bool WebSocketPerMessageDeflateOptions::startsWith(const std::string& str,
const std::string& start)
{
Expand Down
5 changes: 4 additions & 1 deletion ixwebsocket/IXWebSocketPerMessageDeflateOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ namespace ix
bool clientNoContextTakeover = false,
bool serverNoContextTakeover = false,
uint8_t clientMaxWindowBits = kDefaultClientMaxWindowBits,
uint8_t serverMaxWindowBits = kDefaultServerMaxWindowBits);
uint8_t serverMaxWindowBits = kDefaultServerMaxWindowBits,
bool sendClientServerMaxWindowBits = true);

WebSocketPerMessageDeflateOptions(std::string extension);

Expand All @@ -29,6 +30,7 @@ namespace ix
bool getServerNoContextTakeover() const;
uint8_t getServerMaxWindowBits() const;
uint8_t getClientMaxWindowBits() const;
bool getSendClientServerMaxWindowBits() const;

static bool startsWith(const std::string& str, const std::string& start);
static std::string removeSpaces(const std::string& str);
Expand All @@ -40,6 +42,7 @@ namespace ix
bool _enabled;
bool _clientNoContextTakeover;
bool _serverNoContextTakeover;
bool _sendClientServerMaxWindowBits;
uint8_t _clientMaxWindowBits;
uint8_t _serverMaxWindowBits;

Expand Down