Add zlib to support content-encoding (gzip, deflate)

This commit is contained in:
Chunting Gu
2019-03-19 09:36:35 +08:00
parent 616f5a3f5e
commit 5f64f3bb62
126 changed files with 43337 additions and 13 deletions
+1 -1
View File
@@ -4,7 +4,7 @@
set(EXAMPLE_COMMON_LIBS webcc ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES}
"${CMAKE_THREAD_LIBS_INIT}")
if(WIN32)
set(EXAMPLE_COMMON_LIBS ${EXAMPLE_COMMON_LIBS} crypt32)
set(EXAMPLE_COMMON_LIBS ${EXAMPLE_COMMON_LIBS} zlibstatic crypt32)
endif()
if(UNIX)
+10 -1
View File
@@ -16,6 +16,7 @@ bool kSslVerify = true;
#endif
// -----------------------------------------------------------------------------
// Examples
void ExampleBasic() {
HttpClientSession session;
@@ -100,7 +101,15 @@ void ExampleKeepAlive(const std::string& url) {
ssl_verify(kSslVerify));
}
// -----------------------------------------------------------------------------
void ExampleCompression() {
HttpClientSession session;
auto r = session.Get("http://httpbin.org/gzip");
std::cout << r->content() << std::endl;
r = session.Get("http://httpbin.org/deflate");
std::cout << r->content() << std::endl;
}
int main() {
WEBCC_LOG_INIT("", LOG_CONSOLE);