[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-exchange] branch master updated: Fix compression.
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-exchange] branch master updated: Fix compression. |
Date: |
Thu, 16 May 2019 17:00:44 +0200 |
This is an automated email from the git hooks/post-receive script.
marcello pushed a commit to branch master
in repository exchange.
The following commit(s) were added to refs/heads/master by this push:
new 95933156 Fix compression.
95933156 is described below
commit 95933156a6d477460a20225209f556208702d55e
Author: Marcello Stanisci <address@hidden>
AuthorDate: Thu May 16 16:58:09 2019 +0200
Fix compression.
The "Content-Encoding: deflate" header is now added from
within the compression routine itself, and _not_ from the
"exchange handle".
This fixed the bank-lib functions as those do not use any
exchange handle, and therefore were wrongly sending compressed
bodies without adding the mentioned HTTP header.
---
src/bank-lib/bank_api_admin.c | 13 +++++++------
src/lib/exchange_api_handle.c | 6 ------
src/lib/teah_common.c | 4 ++++
src/lib/teah_common.h | 6 +++++-
4 files changed, 16 insertions(+), 13 deletions(-)
diff --git a/src/bank-lib/bank_api_admin.c b/src/bank-lib/bank_api_admin.c
index b04d3e9a..0d07be96 100644
--- a/src/bank-lib/bank_api_admin.c
+++ b/src/bank-lib/bank_api_admin.c
@@ -189,7 +189,6 @@ TALER_BANK_admin_add_incoming (struct GNUNET_CURL_Context
*ctx,
struct TALER_BANK_AdminAddIncomingHandle *aai;
json_t *admin_obj;
CURL *eh;
- struct curl_slist *headers = NULL;
if (NULL == exchange_base_url)
{
@@ -213,11 +212,13 @@ TALER_BANK_admin_add_incoming (struct GNUNET_CURL_Context
*ctx,
aai->cb_cls = res_cb_cls;
aai->request_url = TALER_BANK_path_to_url_ (bank_base_url,
"/admin/add/incoming");
- headers = TALER_BANK_make_auth_header_ (auth);
+ aai->post_ctx.headers = TALER_BANK_make_auth_header_ (auth);
+
+ GNUNET_assert
+ (NULL != (aai->post_ctx.headers = curl_slist_append
+ (aai->post_ctx.headers,
+ "Content-Type: application/json")));
- GNUNET_assert (NULL !=
- (headers = curl_slist_append (headers,
- "Content-Type:
application/json")));
eh = curl_easy_init ();
GNUNET_assert (GNUNET_OK ==
@@ -232,7 +233,7 @@ TALER_BANK_admin_add_incoming (struct GNUNET_CURL_Context
*ctx,
aai->job = GNUNET_CURL_job_add2 (ctx,
eh,
- headers,
+ aai->post_ctx.headers,
&handle_admin_add_incoming_finished,
aai);
return aai;
diff --git a/src/lib/exchange_api_handle.c b/src/lib/exchange_api_handle.c
index 760c1278..fbff68d1 100644
--- a/src/lib/exchange_api_handle.c
+++ b/src/lib/exchange_api_handle.c
@@ -1784,12 +1784,6 @@ TALER_EXCHANGE_connect
GNUNET_break (GNUNET_OK ==
GNUNET_CURL_append_header (ctx,
"Expect:"));
-#if COMPRESS_BODIES
- /* Tell exchange we compress bodies */
- GNUNET_break (GNUNET_OK ==
- GNUNET_CURL_append_header (ctx,
- "Content-Encoding: deflate"));
-#endif
exchange = GNUNET_new (struct TALER_EXCHANGE_Handle);
exchange->ctx = ctx;
exchange->url = GNUNET_strdup (url);
diff --git a/src/lib/teah_common.c b/src/lib/teah_common.c
index 8f994ef3..1cbe9df7 100644
--- a/src/lib/teah_common.c
+++ b/src/lib/teah_common.c
@@ -78,6 +78,10 @@ TEAH_curl_easy_post (struct TEAH_PostContext *ctx,
slen = (size_t) cbuf_size;
ctx->json_enc = (char *) cbuf;
}
+ GNUNET_assert
+ (NULL != (ctx->headers = curl_slist_append
+ (ctx->headers,
+ "Content-Encoding: deflate")));
#else
ctx->json_enc = str;
#endif
diff --git a/src/lib/teah_common.h b/src/lib/teah_common.h
index 66937a26..c7231185 100644
--- a/src/lib/teah_common.h
+++ b/src/lib/teah_common.h
@@ -30,7 +30,7 @@
/**
* Should we compress PUT/POST bodies with 'deflate' encoding?
*/
-#define COMPRESS_BODIES 0
+#define COMPRESS_BODIES 1
/**
* State used for #TEAL_curl_easy_post() and
@@ -43,6 +43,10 @@ struct TEAH_PostContext
*/
char *json_enc;
+ /**
+ * Custom headers.
+ */
+ struct curl_slist *headers;
};
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [taler-exchange] branch master updated: Fix compression.,
gnunet <=