Add an option to disable GZIP.

This commit is contained in:
Chunting Gu
2019-04-22 14:43:46 +08:00
parent 88f5ae3c91
commit 2a868c4dc1
20 changed files with 130 additions and 74 deletions
+7 -6
View File
@@ -10,14 +10,15 @@ set(AT_TARGET_NAME webcc_autotest)
set(AT_LIBS webcc ${Boost_LIBRARIES} "${CMAKE_THREAD_LIBS_INIT}")
if(WEBCC_ENABLE_SSL)
set(AT_LIBS ${AT_LIBS} ${OPENSSL_LIBRARIES})
set(AT_LIBS ${AT_LIBS} ${OPENSSL_LIBRARIES} crypt32)
endif()
if(WIN32)
# TODO: crypt32 should be ssl related.
set(AT_LIBS ${AT_LIBS} zlibstatic crypt32)
else()
set(AT_LIBS ${AT_LIBS} ${ZLIB_LIBRARIES})
if(WEBCC_ENABLE_GZIP)
if(WIN32)
set(AT_LIBS ${AT_LIBS} zlibstatic)
else()
set(AT_LIBS ${AT_LIBS} ${ZLIB_LIBRARIES})
endif()
endif()
if(UNIX)
+10 -1
View File
@@ -48,8 +48,13 @@ static void AssertGet(webcc::ResponsePtr r) {
Json::Value headers = json["headers"];
EXPECT_EQ("application/json", headers["Accept"].asString());
EXPECT_EQ("gzip, deflate", headers["Accept-Encoding"].asString());
EXPECT_EQ("httpbin.org", headers["Host"].asString());
#if WEBCC_ENABLE_GZIP
EXPECT_EQ("gzip, deflate", headers["Accept-Encoding"].asString());
#else
EXPECT_EQ("identity", headers["Accept-Encoding"].asString());
#endif // WEBCC_ENABLE_GZIP
}
TEST(ClientTest, Get_RequestFunc) {
@@ -110,6 +115,8 @@ TEST(ClientTest, Get_SSL) {
// -----------------------------------------------------------------------------
#if WEBCC_ENABLE_GZIP
// Test Gzip compressed response.
TEST(ClientTest, Compression_Gzip) {
webcc::ClientSession session;
@@ -142,6 +149,8 @@ TEST(ClientTest, Compression_Deflate) {
}
}
#endif // WEBCC_ENABLE_GZIP
// -----------------------------------------------------------------------------
// Test persistent (keep-alive) connections.