limit redirects
This commit is contained in:
parent
0a2b049864
commit
cdc8c5b57b
@ -30,7 +30,7 @@
|
||||
* @param url URL to query
|
||||
*/
|
||||
CURL *
|
||||
TEL_curl_easy_get (const char *url)
|
||||
TALER_EXCHANGE_curl_easy_get_ (const char *url)
|
||||
{
|
||||
CURL *eh;
|
||||
|
||||
@ -43,6 +43,12 @@ TEL_curl_easy_get (const char *url)
|
||||
curl_easy_setopt (eh,
|
||||
CURLOPT_FOLLOWLOCATION,
|
||||
1L));
|
||||
/* limit MAXREDIRS to 5 as a simple security measure against
|
||||
a potential infinite loop caused by a malicious target */
|
||||
GNUNET_assert (CURLE_OK ==
|
||||
curl_easy_setopt (eh,
|
||||
CURLOPT_MAXREDIRS,
|
||||
5L));
|
||||
GNUNET_assert (CURLE_OK ==
|
||||
curl_easy_setopt (eh,
|
||||
CURLOPT_TCP_FASTOPEN,
|
||||
|
@ -36,6 +36,6 @@
|
||||
* @param url URL to query
|
||||
*/
|
||||
CURL *
|
||||
TEL_curl_easy_get (const char *url);
|
||||
TALER_EXCHANGE_curl_easy_get_ (const char *url);
|
||||
|
||||
#endif /* _TALER_CURL_DEFAULTS_H */
|
||||
|
@ -626,7 +626,7 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange,
|
||||
dh->dki.key.rsa_public_key = NULL; /* lifetime not warranted, so better
|
||||
not copy the pointer */
|
||||
|
||||
eh = TEL_curl_easy_get (dh->url);
|
||||
eh = TALER_EXCHANGE_curl_easy_get_ (dh->url);
|
||||
if (GNUNET_OK !=
|
||||
TALER_curl_easy_post (&dh->ctx,
|
||||
eh,
|
||||
|
@ -366,7 +366,7 @@ TALER_EXCHANGE_deposits_get (struct TALER_EXCHANGE_Handle *exchange,
|
||||
dwh->depconf.h_contract_terms = *h_contract_terms;
|
||||
dwh->depconf.coin_pub = *coin_pub;
|
||||
|
||||
eh = TEL_curl_easy_get (dwh->url);
|
||||
eh = TALER_EXCHANGE_curl_easy_get_ (dwh->url);
|
||||
ctx = TEAH_handle_to_context (exchange);
|
||||
dwh->job = GNUNET_CURL_job_add (ctx,
|
||||
eh,
|
||||
|
@ -1953,7 +1953,7 @@ request_keys (void *cls)
|
||||
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
|
||||
"Requesting keys with URL `%s'.\n",
|
||||
kr->url);
|
||||
eh = TEL_curl_easy_get (kr->url);
|
||||
eh = TALER_EXCHANGE_curl_easy_get_ (kr->url);
|
||||
GNUNET_assert (CURLE_OK ==
|
||||
curl_easy_setopt (eh,
|
||||
CURLOPT_VERBOSE,
|
||||
|
@ -455,7 +455,7 @@ TALER_EXCHANGE_link (struct TALER_EXCHANGE_Handle *exchange,
|
||||
lh->coin_priv = *coin_priv;
|
||||
lh->url = TEAH_path_to_url (exchange,
|
||||
arg_str);
|
||||
eh = TEL_curl_easy_get (lh->url);
|
||||
eh = TALER_EXCHANGE_curl_easy_get_ (lh->url);
|
||||
ctx = TEAH_handle_to_context (exchange);
|
||||
lh->job = GNUNET_CURL_job_add (ctx,
|
||||
eh,
|
||||
|
@ -456,7 +456,7 @@ TALER_EXCHANGE_melt (struct TALER_EXCHANGE_Handle *exchange,
|
||||
mh->md = md;
|
||||
mh->url = TEAH_path_to_url (exchange,
|
||||
arg_str);
|
||||
eh = TEL_curl_easy_get (mh->url);
|
||||
eh = TALER_EXCHANGE_curl_easy_get_ (mh->url);
|
||||
if (GNUNET_OK !=
|
||||
TALER_curl_easy_post (&mh->ctx,
|
||||
eh,
|
||||
|
@ -389,7 +389,7 @@ TALER_EXCHANGE_recoup (struct TALER_EXCHANGE_Handle *exchange,
|
||||
ph->url = TEAH_path_to_url (exchange,
|
||||
arg_str);
|
||||
ph->was_refreshed = was_refreshed;
|
||||
eh = TEL_curl_easy_get (ph->url);
|
||||
eh = TALER_EXCHANGE_curl_easy_get_ (ph->url);
|
||||
if (GNUNET_OK !=
|
||||
TALER_curl_easy_post (&ph->ctx,
|
||||
eh,
|
||||
|
@ -461,7 +461,7 @@ TALER_EXCHANGE_refreshes_reveal (struct TALER_EXCHANGE_Handle *exchange,
|
||||
rrh->url = TEAH_path_to_url (rrh->exchange,
|
||||
arg_str);
|
||||
|
||||
eh = TEL_curl_easy_get (rrh->url);
|
||||
eh = TALER_EXCHANGE_curl_easy_get_ (rrh->url);
|
||||
if (GNUNET_OK !=
|
||||
TALER_curl_easy_post (&rrh->ctx,
|
||||
eh,
|
||||
|
@ -387,7 +387,7 @@ TALER_EXCHANGE_refund2 (struct TALER_EXCHANGE_Handle *exchange,
|
||||
TALER_amount_hton (&rh->depconf.refund_fee,
|
||||
refund_fee);
|
||||
|
||||
eh = TEL_curl_easy_get (rh->url);
|
||||
eh = TALER_EXCHANGE_curl_easy_get_ (rh->url);
|
||||
if (GNUNET_OK !=
|
||||
TALER_curl_easy_post (&rh->ctx,
|
||||
eh,
|
||||
|
@ -274,7 +274,7 @@ TALER_EXCHANGE_reserves_get (struct TALER_EXCHANGE_Handle *exchange,
|
||||
rgh->reserve_pub = *reserve_pub;
|
||||
rgh->url = TEAH_path_to_url (exchange,
|
||||
arg_str);
|
||||
eh = TEL_curl_easy_get (rgh->url);
|
||||
eh = TALER_EXCHANGE_curl_easy_get_ (rgh->url);
|
||||
ctx = TEAH_handle_to_context (exchange);
|
||||
rgh->job = GNUNET_CURL_job_add (ctx,
|
||||
eh,
|
||||
|
@ -366,7 +366,7 @@ TALER_EXCHANGE_transfers_get (struct TALER_EXCHANGE_Handle *exchange,
|
||||
}
|
||||
wdh->url = TEAH_path_to_url (wdh->exchange,
|
||||
arg_str);
|
||||
eh = TEL_curl_easy_get (wdh->url);
|
||||
eh = TALER_EXCHANGE_curl_easy_get_ (wdh->url);
|
||||
ctx = TEAH_handle_to_context (exchange);
|
||||
wdh->job = GNUNET_CURL_job_add (ctx,
|
||||
eh,
|
||||
|
@ -407,7 +407,7 @@ TALER_EXCHANGE_wire (struct TALER_EXCHANGE_Handle *exchange,
|
||||
wh->cb_cls = wire_cb_cls;
|
||||
wh->url = TEAH_path_to_url (exchange, "/wire");
|
||||
|
||||
eh = TEL_curl_easy_get (wh->url);
|
||||
eh = TALER_EXCHANGE_curl_easy_get_ (wh->url);
|
||||
ctx = TEAH_handle_to_context (exchange);
|
||||
wh->job = GNUNET_CURL_job_add (ctx,
|
||||
eh,
|
||||
|
@ -426,7 +426,7 @@ reserve_withdraw_internal (struct TALER_EXCHANGE_Handle *exchange,
|
||||
wh->ps = *ps;
|
||||
wh->url = TEAH_path_to_url (exchange,
|
||||
arg_str);
|
||||
eh = TEL_curl_easy_get (wh->url);
|
||||
eh = TALER_EXCHANGE_curl_easy_get_ (wh->url);
|
||||
if (GNUNET_OK !=
|
||||
TALER_curl_easy_post (&wh->ctx,
|
||||
eh,
|
||||
|
Loading…
Reference in New Issue
Block a user