2018-11-09 18:23:49 -08:00
|
|
|
/*
|
|
|
|
* IXWebSocketPerMessageDeflateOptions.h
|
|
|
|
* Author: Benjamin Sergeant
|
|
|
|
* Copyright (c) 2018 Machine Zone, Inc. All rights reserved.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
2019-02-20 18:59:07 -08:00
|
|
|
namespace ix
|
2018-11-09 18:23:49 -08:00
|
|
|
{
|
|
|
|
class WebSocketPerMessageDeflateOptions
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
WebSocketPerMessageDeflateOptions(
|
2018-11-13 17:46:05 -08:00
|
|
|
bool enabled = false,
|
2018-11-09 18:23:49 -08:00
|
|
|
bool clientNoContextTakeover = false,
|
|
|
|
bool serverNoContextTakeover = false,
|
|
|
|
uint8_t clientMaxWindowBits = kDefaultClientMaxWindowBits,
|
|
|
|
uint8_t serverMaxWindowBits = kDefaultServerMaxWindowBits);
|
|
|
|
|
|
|
|
WebSocketPerMessageDeflateOptions(std::string extension);
|
|
|
|
|
|
|
|
std::string generateHeader();
|
|
|
|
bool enabled() const;
|
|
|
|
bool getClientNoContextTakeover() const;
|
|
|
|
bool getServerNoContextTakeover() const;
|
|
|
|
uint8_t getServerMaxWindowBits() const;
|
|
|
|
uint8_t getClientMaxWindowBits() const;
|
|
|
|
|
|
|
|
static bool startsWith(const std::string& str, const std::string& start);
|
|
|
|
static std::string removeSpaces(const std::string& str);
|
|
|
|
|
2018-11-13 17:46:05 -08:00
|
|
|
static uint8_t const kDefaultClientMaxWindowBits;
|
|
|
|
static uint8_t const kDefaultServerMaxWindowBits;
|
|
|
|
|
2018-11-09 18:23:49 -08:00
|
|
|
private:
|
|
|
|
bool _enabled;
|
|
|
|
bool _clientNoContextTakeover;
|
|
|
|
bool _serverNoContextTakeover;
|
2021-06-05 21:23:18 +03:00
|
|
|
uint8_t _clientMaxWindowBits;
|
|
|
|
uint8_t _serverMaxWindowBits;
|
2019-09-04 21:01:30 -07:00
|
|
|
|
|
|
|
void sanitizeClientMaxWindowBits();
|
2018-11-09 18:23:49 -08:00
|
|
|
};
|
2019-05-30 08:46:50 -07:00
|
|
|
} // namespace ix
|