commit 4c92c8aa27437a2f6b29749af187c0e15d13f83f
parent 992bf9932c0e112f7c18ec613a7e7b877088b41f
Author: Marcello Stanisci <stanisci.m@gmail.com>
Date: Thu, 20 Dec 2018 11:02:45 +0100
Init zlib if needed.
Diffstat:
3 files changed, 30 insertions(+), 3 deletions(-)
diff --git a/m4/libtool.m4 b/m4/libtool.m4
@@ -4063,7 +4063,8 @@ _LT_EOF
if AC_TRY_EVAL(ac_compile); then
# Now try to grab the symbols.
nlist=conftest.nm
- if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then
+ $ECHO "$as_me:$LINENO: $NM conftest.$ac_objext | $lt_cv_sys_global_symbol_pipe > $nlist" >&AS_MESSAGE_LOG_FD
+ if eval "$NM" conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist 2>&AS_MESSAGE_LOG_FD && test -s "$nlist"; then
# Try sorting and uniquifying the output.
if sort "$nlist" | uniq > "$nlist"T; then
mv -f "$nlist"T "$nlist"
diff --git a/src/twister/Makefile.am b/src/twister/Makefile.am
@@ -17,7 +17,8 @@ taler_twister_service_LDADD = \
-lmicrohttpd \
-lcurl \
-ljansson \
- -lgnunetutil
+ -lgnunetutil \
+ -lz
taler_twister_SOURCES = taler-twister.c
taler_twister_LDADD = \
diff --git a/src/twister/taler-twister-service.c b/src/twister/taler-twister-service.c
@@ -39,6 +39,7 @@
#include <jansson.h>
#include <microhttpd.h>
#include <taler/taler_util.h>
+#include <zlib.h>
/**
* Log curl error.
@@ -82,7 +83,6 @@ enum RequestState
* We've finished receiving download data from cURL.
*/
REQUEST_STATE_DOWNLOAD_DONE
-
};
@@ -225,6 +225,11 @@ struct HttpRequest
* a compressed body.
*/
int deflate;
+
+ /**
+ * Zlib internal state.
+ */
+ z_stream zstate;
};
@@ -887,6 +892,22 @@ con_val_iter (void *cls,
curl_easy_setopt (hr->curl,
CURLOPT_ENCODING,
"deflate");
+ /**
+ * Init deflating structs here.
+ */
+ hr->zstate.zalloc = Z_NULL;
+ hr->zstate.zfree = Z_NULL;
+ hr->zstate.opaque = Z_NULL;
+
+ if (Z_OK != deflateInit (&hr->zstate,
+ Z_DEFAULT_COMPRESSION))
+ {
+ TALER_LOG_ERROR ("Failed to initialize compression\n");
+ /* FIXME: put here a "emergency call" to suddenly return
+ * to the client. */
+ return MHD_NO;
+ }
+
return MHD_YES;
}
@@ -1684,6 +1705,10 @@ create_response (void *cls,
malform = GNUNET_NO;
}
+ /**
+ * hr->io_len is to compress -- or compressed?
+ */
+
hr->response = MHD_create_response_from_buffer
(hr->io_len,
hr->io_buf,