(WebSocketServer) add option to disable deflate compression, exposed with the -x option to ws echo_server

This commit is contained in:
Benjamin Sergeant
2020-02-18 21:38:28 -08:00
parent 111475e65c
commit 4c66a7561e
12 changed files with 61 additions and 22 deletions

View File

@ -12,6 +12,7 @@
#include "IXUserAgent.h"
#include "libwshandshake.hpp"
#include <algorithm>
#include <iostream>
#include <random>
#include <sstream>
@ -335,8 +336,9 @@ namespace ix
std::string header = headers["sec-websocket-extensions"];
WebSocketPerMessageDeflateOptions webSocketPerMessageDeflateOptions(header);
// If the client has requested that extension, enable it.
if (webSocketPerMessageDeflateOptions.enabled())
// If the client has requested that extension,
// and the server does not prevent it, enable it.
if (_enablePerMessageDeflate && webSocketPerMessageDeflateOptions.enabled())
{
_enablePerMessageDeflate = true;