Allow UWS_NO_ZLIB to work properly

This commit is contained in:
Alex Hultman
2018-12-29 14:00:26 +01:00
parent e70eb78ae3
commit 6befbd4a37
3 changed files with 24 additions and 3 deletions
+17 -1
View File
@@ -19,7 +19,19 @@
#ifndef PERMESSAGEDEFLATE_H
#define PERMESSAGEDEFLATE_H
/* Do not compile this module if we don't want it */
#ifndef UWS_NO_ZLIB
#ifdef UWS_NO_ZLIB
struct ZlibContext {};
struct InflationStream {
std::string_view inflate(ZlibContext *zlibContext, std::string_view compressed, size_t maxPayloadLength) {
return compressed;
}
};
struct DeflationStream {
std::string_view deflate(ZlibContext *zlibContext, std::string_view raw, bool reset) {
return raw;
}
};
#else
#include <zlib.h>
@@ -109,6 +121,10 @@ struct InflationStream {
inflateInit2(&inflationStream, -15);
}
~InflationStream() {
std::cout << "Destructing inflationstream" << std::endl;
}
std::string_view inflate(ZlibContext *zlibContext, std::string_view compressed, size_t maxPayloadLength) {
/* We clear this one here, could be done better */