From 68faec5da3c21fd11621f33189eefff2bcf9e827 Mon Sep 17 00:00:00 2001 From: Artyom Beilis Date: Thu, 10 May 2018 12:16:03 +0300 Subject: [PATCH] Fixed #36 - failing to build with disabled gzip --- src/cache_server_main.cpp | 5 ++++- src/session_pool.cpp | 5 ++++- tests/storage_test.cpp | 2 ++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/cache_server_main.cpp b/src/cache_server_main.cpp index 2a1cedd..e81e286 100644 --- a/src/cache_server_main.cpp +++ b/src/cache_server_main.cpp @@ -127,6 +127,7 @@ struct settings { gc=v.get("session.gc",10); std::string stor = v.get("session.storage",""); if(!stor.empty()) { + #ifndef CPPCMS_NO_GZIP if(stor == "files") { std::string dir = v.get("session.dir",""); #ifdef CPPCMS_WIN_NATIVE @@ -135,7 +136,9 @@ struct settings { sessions.reset(new cppcms::sessions::session_file_storage_factory(dir,threads,1,false)); #endif } - else if(stor == "memory") { + else + #endif //CPPCMS_NO_GZIP + if(stor == "memory") { sessions.reset(new cppcms::sessions::session_memory_storage_factory()); } else if(stor == "external") { diff --git a/src/session_pool.cpp b/src/session_pool.cpp index 2de034c..feb09e2 100644 --- a/src/session_pool.cpp +++ b/src/session_pool.cpp @@ -230,6 +230,7 @@ void session_pool::init() if((location == "server" || location == "both") && !storage_.get()) { std::string stor=settings.get("session.server.storage"); std::auto_ptr factory; + #ifndef CPPCMS_NO_GZIP if(stor == "files") { std::string dir = settings.get("session.server.dir",""); #ifdef CPPCMS_WIN_NATIVE @@ -251,7 +252,9 @@ void session_pool::init() } #endif } - else if(stor == "memory") { + else + #endif// CPPCMS_NO_GZIP + if(stor == "memory") { if(!service_) { throw cppcms_error("Can't use memory storage for external session management"); } diff --git a/tests/storage_test.cpp b/tests/storage_test.cpp index e3d0883..7718443 100644 --- a/tests/storage_test.cpp +++ b/tests/storage_test.cpp @@ -133,6 +133,7 @@ int main() storage=mem.get(); test(storage,mem); std::cout << "Testing file storage" << std::endl; + #ifndef CPPCMS_NO_GZIP #ifndef CPPCMS_WIN_NATIVE std::cout << "Testing single process" << std::endl; session_file_storage_factory f1(dir,5,1,false); @@ -151,6 +152,7 @@ int main() storage=f.get(); test_files(storage,f); #endif + #endif #ifndef CPPCMS_NO_TCP_CACHE std::cout << "Testing network backend" << std::endl;