clang format
This commit is contained in:
@ -103,9 +103,9 @@ namespace ix
|
||||
std::thread _thread;
|
||||
|
||||
std::unique_ptr<Socket> _socket;
|
||||
std::recursive_mutex _mutex; // to protect accessing the _socket (only one socket per client)
|
||||
// the mutex needs to be recursive as this function might
|
||||
// be called recursively to follow HTTP redirections
|
||||
std::recursive_mutex _mutex; // to protect accessing the _socket (only one socket per
|
||||
// client) the mutex needs to be recursive as this function
|
||||
// might be called recursively to follow HTTP redirections
|
||||
|
||||
SocketTLSOptions _tlsOptions;
|
||||
|
||||
|
@ -9,11 +9,11 @@
|
||||
#include "IXNetSystem.h"
|
||||
#include "IXSocketConnect.h"
|
||||
#include "IXUserAgent.h"
|
||||
#include <cstring>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
#include <zlib.h>
|
||||
#include <cstring>
|
||||
|
||||
namespace
|
||||
{
|
||||
@ -50,8 +50,11 @@ namespace
|
||||
const int windowBits = 15;
|
||||
const int GZIP_ENCODING = 16;
|
||||
|
||||
deflateInit2(&zs, Z_DEFAULT_COMPRESSION, Z_DEFLATED,
|
||||
windowBits | GZIP_ENCODING, 8,
|
||||
deflateInit2(&zs,
|
||||
Z_DEFAULT_COMPRESSION,
|
||||
Z_DEFLATED,
|
||||
windowBits | GZIP_ENCODING,
|
||||
8,
|
||||
Z_DEFAULT_STRATEGY);
|
||||
|
||||
zs.next_in = (Bytef*) str.data();
|
||||
@ -69,13 +72,12 @@ namespace
|
||||
|
||||
ret = deflate(&zs, Z_FINISH);
|
||||
|
||||
if(outstring.size() < zs.total_out)
|
||||
if (outstring.size() < zs.total_out)
|
||||
{
|
||||
// append the block to the output string
|
||||
outstring.append(outbuffer,
|
||||
zs.total_out - outstring.size());
|
||||
outstring.append(outbuffer, zs.total_out - outstring.size());
|
||||
}
|
||||
} while(ret == Z_OK);
|
||||
} while (ret == Z_OK);
|
||||
|
||||
deflateEnd(&zs);
|
||||
|
||||
|
@ -32,8 +32,8 @@
|
||||
#include "IXUrlParser.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -75,22 +75,26 @@ namespace ix
|
||||
return compressData(in, out);
|
||||
}
|
||||
|
||||
bool WebSocketPerMessageDeflateCompressor::compress(const std::string& in, std::vector<uint8_t>& out)
|
||||
bool WebSocketPerMessageDeflateCompressor::compress(const std::string& in,
|
||||
std::vector<uint8_t>& out)
|
||||
{
|
||||
return compressData(in, out);
|
||||
}
|
||||
|
||||
bool WebSocketPerMessageDeflateCompressor::compress(const std::vector<uint8_t>& in, std::string& out)
|
||||
bool WebSocketPerMessageDeflateCompressor::compress(const std::vector<uint8_t>& in,
|
||||
std::string& out)
|
||||
{
|
||||
return compressData(in, out);
|
||||
}
|
||||
|
||||
bool WebSocketPerMessageDeflateCompressor::compress(const std::vector<uint8_t>& in, std::vector<uint8_t>& out)
|
||||
bool WebSocketPerMessageDeflateCompressor::compress(const std::vector<uint8_t>& in,
|
||||
std::vector<uint8_t>& out)
|
||||
{
|
||||
return compressData(in, out);
|
||||
}
|
||||
|
||||
template<typename T, typename S> bool WebSocketPerMessageDeflateCompressor::compressData(const T& in, S& out)
|
||||
template<typename T, typename S>
|
||||
bool WebSocketPerMessageDeflateCompressor::compressData(const T& in, S& out)
|
||||
{
|
||||
//
|
||||
// 7.2.1. Compression
|
||||
|
@ -26,8 +26,10 @@ namespace ix
|
||||
bool compress(const std::vector<uint8_t>& in, std::vector<uint8_t>& out);
|
||||
|
||||
private:
|
||||
template<typename T, typename S> bool compressData(const T& in, S& out);
|
||||
template<typename T> bool endsWithEmptyUnCompressedBlock(const T& value);
|
||||
template<typename T, typename S>
|
||||
bool compressData(const T& in, S& out);
|
||||
template<typename T>
|
||||
bool endsWithEmptyUnCompressedBlock(const T& value);
|
||||
|
||||
int _flush;
|
||||
size_t _compressBufferSize;
|
||||
|
@ -246,11 +246,8 @@ namespace ix
|
||||
const OnProgressCallback& onProgressCallback = nullptr);
|
||||
|
||||
template<class Iterator>
|
||||
bool sendFragment(wsheader_type::opcode_type type,
|
||||
bool fin,
|
||||
Iterator begin,
|
||||
Iterator end,
|
||||
bool compress);
|
||||
bool sendFragment(
|
||||
wsheader_type::opcode_type type, bool fin, Iterator begin, Iterator end, bool compress);
|
||||
|
||||
void emitMessage(MessageKind messageKind,
|
||||
const std::string& message,
|
||||
|
Reference in New Issue
Block a user