diff options
author | Marcello Stanisci <stanisci.m@gmail.com> | 2019-05-17 16:30:37 +0200 |
---|---|---|
committer | Marcello Stanisci <stanisci.m@gmail.com> | 2019-05-17 16:30:37 +0200 |
commit | 69f1863d899f93a380fbe6be7a73a6467b2a61c3 (patch) | |
tree | a85411bec96b5061966415c052aae0b019854e8d /src | |
parent | 95933156a6d477460a20225209f556208702d55e (diff) |
Compression.
Inclusion of 'content-encoding: deflate' header now (really) happens
per request, and not "per state" (where any request got this header
appended and broke those unaware requests that didn't compress their
data.)
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/auditor_api_curl_defaults.c | 4 | ||||
-rw-r--r-- | src/lib/auditor_api_handle.c | 6 | ||||
-rw-r--r-- | src/lib/exchange_api_curl_defaults.c | 5 | ||||
-rw-r--r-- | src/lib/exchange_api_deposit.c | 10 | ||||
-rw-r--r-- | src/lib/exchange_api_payback.c | 10 | ||||
-rw-r--r-- | src/lib/exchange_api_refresh.c | 20 | ||||
-rw-r--r-- | src/lib/exchange_api_refund.c | 10 | ||||
-rw-r--r-- | src/lib/exchange_api_reserve.c | 10 | ||||
-rw-r--r-- | src/lib/exchange_api_track_transaction.c | 10 | ||||
-rw-r--r-- | src/lib/teah_common.c | 6 |
10 files changed, 41 insertions, 50 deletions
diff --git a/src/lib/auditor_api_curl_defaults.c b/src/lib/auditor_api_curl_defaults.c index 7beb592ee..f3286ca9e 100644 --- a/src/lib/auditor_api_curl_defaults.c +++ b/src/lib/auditor_api_curl_defaults.c @@ -45,10 +45,6 @@ TAL_curl_easy_get (const char *url) url)); GNUNET_assert (CURLE_OK == curl_easy_setopt (eh, - CURLOPT_ENCODING, - "deflate")); - GNUNET_assert (CURLE_OK == - curl_easy_setopt (eh, CURLOPT_TCP_FASTOPEN, 1L)); diff --git a/src/lib/auditor_api_handle.c b/src/lib/auditor_api_handle.c index 73ed6b3a3..8077b80cf 100644 --- a/src/lib/auditor_api_handle.c +++ b/src/lib/auditor_api_handle.c @@ -466,12 +466,6 @@ TALER_AUDITOR_connect (struct GNUNET_CURL_Context *ctx, GNUNET_break (GNUNET_OK == GNUNET_CURL_append_header (ctx, "Expect:")); -#if COMPRESS_BODIES - /* Tell auditor we compress bodies */ - GNUNET_break (GNUNET_OK == - GNUNET_CURL_append_header (ctx, - "Content-Encoding: deflate")); -#endif auditor = GNUNET_new (struct TALER_AUDITOR_Handle); auditor->ctx = ctx; auditor->url = GNUNET_strdup (url); diff --git a/src/lib/exchange_api_curl_defaults.c b/src/lib/exchange_api_curl_defaults.c index 57fae166d..36d1edf7b 100644 --- a/src/lib/exchange_api_curl_defaults.c +++ b/src/lib/exchange_api_curl_defaults.c @@ -42,11 +42,6 @@ TEL_curl_easy_get (const char *url) url)); GNUNET_assert (CURLE_OK == curl_easy_setopt (eh, - CURLOPT_ENCODING, - "deflate")); - - GNUNET_assert (CURLE_OK == - curl_easy_setopt (eh, CURLOPT_FOLLOWLOCATION, 1L)); GNUNET_assert (CURLE_OK == diff --git a/src/lib/exchange_api_deposit.c b/src/lib/exchange_api_deposit.c index b99c7a93f..c5fdd7bd4 100644 --- a/src/lib/exchange_api_deposit.c +++ b/src/lib/exchange_api_deposit.c @@ -599,11 +599,11 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange, "URL for deposit: `%s'\n", dh->url); ctx = TEAH_handle_to_context (exchange); - dh->job = GNUNET_CURL_job_add (ctx, - eh, - GNUNET_YES, - &handle_deposit_finished, - dh); + dh->job = GNUNET_CURL_job_add2 (ctx, + eh, + dh->ctx.headers, + &handle_deposit_finished, + dh); return dh; } diff --git a/src/lib/exchange_api_payback.c b/src/lib/exchange_api_payback.c index 325263d71..813cc70d1 100644 --- a/src/lib/exchange_api_payback.c +++ b/src/lib/exchange_api_payback.c @@ -340,11 +340,11 @@ TALER_EXCHANGE_payback (struct TALER_EXCHANGE_Handle *exchange, "URL for payback: `%s'\n", ph->url); ctx = TEAH_handle_to_context (exchange); - ph->job = GNUNET_CURL_job_add (ctx, - eh, - GNUNET_YES, - &handle_payback_finished, - ph); + ph->job = GNUNET_CURL_job_add2 (ctx, + eh, + ph->ctx.headers, + &handle_payback_finished, + ph); return ph; } diff --git a/src/lib/exchange_api_refresh.c b/src/lib/exchange_api_refresh.c index 30025d778..d424015a2 100644 --- a/src/lib/exchange_api_refresh.c +++ b/src/lib/exchange_api_refresh.c @@ -1221,11 +1221,11 @@ TALER_EXCHANGE_refresh_melt (struct TALER_EXCHANGE_Handle *exchange, } json_decref (melt_obj); ctx = TEAH_handle_to_context (exchange); - rmh->job = GNUNET_CURL_job_add (ctx, - eh, - GNUNET_YES, - &handle_refresh_melt_finished, - rmh); + rmh->job = GNUNET_CURL_job_add2 (ctx, + eh, + rmh->ctx.headers, + &handle_refresh_melt_finished, + rmh); return rmh; } @@ -1651,11 +1651,11 @@ TALER_EXCHANGE_refresh_reveal (struct TALER_EXCHANGE_Handle *exchange, } json_decref (reveal_obj); ctx = TEAH_handle_to_context (rrh->exchange); - rrh->job = GNUNET_CURL_job_add (ctx, - eh, - GNUNET_YES, - &handle_refresh_reveal_finished, - rrh); + rrh->job = GNUNET_CURL_job_add2 (ctx, + eh, + rrh->ctx.headers, + &handle_refresh_reveal_finished, + rrh); return rrh; } diff --git a/src/lib/exchange_api_refund.c b/src/lib/exchange_api_refund.c index 142213177..1fd2c4f01 100644 --- a/src/lib/exchange_api_refund.c +++ b/src/lib/exchange_api_refund.c @@ -386,11 +386,11 @@ refund_obj = json_pack ("{s:o, s:o," /* amount/fee */ "URL for refund: `%s'\n", rh->url); ctx = TEAH_handle_to_context (exchange); - rh->job = GNUNET_CURL_job_add (ctx, - eh, - GNUNET_YES, - &handle_refund_finished, - rh); + rh->job = GNUNET_CURL_job_add2 (ctx, + eh, + rh->ctx.headers, + &handle_refund_finished, + rh); return rh; } diff --git a/src/lib/exchange_api_reserve.c b/src/lib/exchange_api_reserve.c index ae0bd01d0..d39d2c4ce 100644 --- a/src/lib/exchange_api_reserve.c +++ b/src/lib/exchange_api_reserve.c @@ -1044,11 +1044,11 @@ reserve_withdraw_internal (struct TALER_EXCHANGE_Handle *exchange, } json_decref (withdraw_obj); ctx = TEAH_handle_to_context (exchange); - wsh->job = GNUNET_CURL_job_add (ctx, - eh, - GNUNET_YES, - &handle_reserve_withdraw_finished, - wsh); + wsh->job = GNUNET_CURL_job_add2 (ctx, + eh, + wsh->ctx.headers, + &handle_reserve_withdraw_finished, + wsh); return wsh; } diff --git a/src/lib/exchange_api_track_transaction.c b/src/lib/exchange_api_track_transaction.c index 67efd77af..59328b6a7 100644 --- a/src/lib/exchange_api_track_transaction.c +++ b/src/lib/exchange_api_track_transaction.c @@ -337,11 +337,11 @@ TALER_EXCHANGE_track_transaction (struct TALER_EXCHANGE_Handle *exchange, } json_decref (deposit_wtid_obj); ctx = TEAH_handle_to_context (exchange); - dwh->job = GNUNET_CURL_job_add (ctx, - eh, - GNUNET_YES, - &handle_deposit_wtid_finished, - dwh); + dwh->job = GNUNET_CURL_job_add2 (ctx, + eh, + dwh->ctx.headers, + &handle_deposit_wtid_finished, + dwh); return dwh; } diff --git a/src/lib/teah_common.c b/src/lib/teah_common.c index 1cbe9df78..f3e1cfeb5 100644 --- a/src/lib/teah_common.c +++ b/src/lib/teah_common.c @@ -85,6 +85,12 @@ TEAH_curl_easy_post (struct TEAH_PostContext *ctx, #else ctx->json_enc = str; #endif + + GNUNET_assert + (NULL != (ctx->headers = curl_slist_append + (ctx->headers, + "Content-Type: application/json"))); + GNUNET_assert (CURLE_OK == curl_easy_setopt (eh, CURLOPT_POSTFIELDS, |