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.)
This commit is contained in:
Marcello Stanisci 2019-05-17 16:30:37 +02:00
parent 95933156a6
commit 69f1863d89
No known key found for this signature in database
GPG Key ID: 8D526861953F4C0F
10 changed files with 41 additions and 50 deletions

View File

@ -43,10 +43,6 @@ TAL_curl_easy_get (const char *url)
curl_easy_setopt (eh, curl_easy_setopt (eh,
CURLOPT_URL, CURLOPT_URL,
url)); url));
GNUNET_assert (CURLE_OK ==
curl_easy_setopt (eh,
CURLOPT_ENCODING,
"deflate"));
GNUNET_assert (CURLE_OK == GNUNET_assert (CURLE_OK ==
curl_easy_setopt (eh, curl_easy_setopt (eh,
CURLOPT_TCP_FASTOPEN, CURLOPT_TCP_FASTOPEN,

View File

@ -466,12 +466,6 @@ TALER_AUDITOR_connect (struct GNUNET_CURL_Context *ctx,
GNUNET_break (GNUNET_OK == GNUNET_break (GNUNET_OK ==
GNUNET_CURL_append_header (ctx, GNUNET_CURL_append_header (ctx,
"Expect:")); "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 = GNUNET_new (struct TALER_AUDITOR_Handle);
auditor->ctx = ctx; auditor->ctx = ctx;
auditor->url = GNUNET_strdup (url); auditor->url = GNUNET_strdup (url);

View File

@ -40,11 +40,6 @@ TEL_curl_easy_get (const char *url)
curl_easy_setopt (eh, curl_easy_setopt (eh,
CURLOPT_URL, CURLOPT_URL,
url)); url));
GNUNET_assert (CURLE_OK ==
curl_easy_setopt (eh,
CURLOPT_ENCODING,
"deflate"));
GNUNET_assert (CURLE_OK == GNUNET_assert (CURLE_OK ==
curl_easy_setopt (eh, curl_easy_setopt (eh,
CURLOPT_FOLLOWLOCATION, CURLOPT_FOLLOWLOCATION,

View File

@ -599,11 +599,11 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange,
"URL for deposit: `%s'\n", "URL for deposit: `%s'\n",
dh->url); dh->url);
ctx = TEAH_handle_to_context (exchange); ctx = TEAH_handle_to_context (exchange);
dh->job = GNUNET_CURL_job_add (ctx, dh->job = GNUNET_CURL_job_add2 (ctx,
eh, eh,
GNUNET_YES, dh->ctx.headers,
&handle_deposit_finished, &handle_deposit_finished,
dh); dh);
return dh; return dh;
} }

View File

@ -340,11 +340,11 @@ TALER_EXCHANGE_payback (struct TALER_EXCHANGE_Handle *exchange,
"URL for payback: `%s'\n", "URL for payback: `%s'\n",
ph->url); ph->url);
ctx = TEAH_handle_to_context (exchange); ctx = TEAH_handle_to_context (exchange);
ph->job = GNUNET_CURL_job_add (ctx, ph->job = GNUNET_CURL_job_add2 (ctx,
eh, eh,
GNUNET_YES, ph->ctx.headers,
&handle_payback_finished, &handle_payback_finished,
ph); ph);
return ph; return ph;
} }

View File

@ -1221,11 +1221,11 @@ TALER_EXCHANGE_refresh_melt (struct TALER_EXCHANGE_Handle *exchange,
} }
json_decref (melt_obj); json_decref (melt_obj);
ctx = TEAH_handle_to_context (exchange); ctx = TEAH_handle_to_context (exchange);
rmh->job = GNUNET_CURL_job_add (ctx, rmh->job = GNUNET_CURL_job_add2 (ctx,
eh, eh,
GNUNET_YES, rmh->ctx.headers,
&handle_refresh_melt_finished, &handle_refresh_melt_finished,
rmh); rmh);
return rmh; return rmh;
} }
@ -1651,11 +1651,11 @@ TALER_EXCHANGE_refresh_reveal (struct TALER_EXCHANGE_Handle *exchange,
} }
json_decref (reveal_obj); json_decref (reveal_obj);
ctx = TEAH_handle_to_context (rrh->exchange); ctx = TEAH_handle_to_context (rrh->exchange);
rrh->job = GNUNET_CURL_job_add (ctx, rrh->job = GNUNET_CURL_job_add2 (ctx,
eh, eh,
GNUNET_YES, rrh->ctx.headers,
&handle_refresh_reveal_finished, &handle_refresh_reveal_finished,
rrh); rrh);
return rrh; return rrh;
} }

View File

@ -386,11 +386,11 @@ refund_obj = json_pack ("{s:o, s:o," /* amount/fee */
"URL for refund: `%s'\n", "URL for refund: `%s'\n",
rh->url); rh->url);
ctx = TEAH_handle_to_context (exchange); ctx = TEAH_handle_to_context (exchange);
rh->job = GNUNET_CURL_job_add (ctx, rh->job = GNUNET_CURL_job_add2 (ctx,
eh, eh,
GNUNET_YES, rh->ctx.headers,
&handle_refund_finished, &handle_refund_finished,
rh); rh);
return rh; return rh;
} }

View File

@ -1044,11 +1044,11 @@ reserve_withdraw_internal (struct TALER_EXCHANGE_Handle *exchange,
} }
json_decref (withdraw_obj); json_decref (withdraw_obj);
ctx = TEAH_handle_to_context (exchange); ctx = TEAH_handle_to_context (exchange);
wsh->job = GNUNET_CURL_job_add (ctx, wsh->job = GNUNET_CURL_job_add2 (ctx,
eh, eh,
GNUNET_YES, wsh->ctx.headers,
&handle_reserve_withdraw_finished, &handle_reserve_withdraw_finished,
wsh); wsh);
return wsh; return wsh;
} }

View File

@ -337,11 +337,11 @@ TALER_EXCHANGE_track_transaction (struct TALER_EXCHANGE_Handle *exchange,
} }
json_decref (deposit_wtid_obj); json_decref (deposit_wtid_obj);
ctx = TEAH_handle_to_context (exchange); ctx = TEAH_handle_to_context (exchange);
dwh->job = GNUNET_CURL_job_add (ctx, dwh->job = GNUNET_CURL_job_add2 (ctx,
eh, eh,
GNUNET_YES, dwh->ctx.headers,
&handle_deposit_wtid_finished, &handle_deposit_wtid_finished,
dwh); dwh);
return dwh; return dwh;
} }

View File

@ -85,6 +85,12 @@ TEAH_curl_easy_post (struct TEAH_PostContext *ctx,
#else #else
ctx->json_enc = str; ctx->json_enc = str;
#endif #endif
GNUNET_assert
(NULL != (ctx->headers = curl_slist_append
(ctx->headers,
"Content-Type: application/json")));
GNUNET_assert (CURLE_OK == GNUNET_assert (CURLE_OK ==
curl_easy_setopt (eh, curl_easy_setopt (eh,
CURLOPT_POSTFIELDS, CURLOPT_POSTFIELDS,