From ef77268059b78e11226a23b72f500238e83d399a Mon Sep 17 00:00:00 2001 From: Marc Fournier Date: Fri, 16 Jan 2015 23:45:26 +0100 Subject: [PATCH] ensure all curl-based plugins follow HTTP redirects For the sake of consistency. --- src/curl_json.c | 2 ++ src/curl_xml.c | 2 ++ src/write_http.c | 2 ++ 3 files changed, 6 insertions(+) diff --git a/src/curl_json.c b/src/curl_json.c index b79c999e..09db7866 100644 --- a/src/curl_json.c +++ b/src/curl_json.c @@ -608,6 +608,8 @@ static int cj_init_curl (cj_t *db) /* {{{ */ curl_easy_setopt (db->curl, CURLOPT_USERAGENT, COLLECTD_USERAGENT); curl_easy_setopt (db->curl, CURLOPT_ERRORBUFFER, db->curl_errbuf); curl_easy_setopt (db->curl, CURLOPT_URL, db->url); + curl_easy_setopt (db->curl, CURLOPT_FOLLOWLOCATION, 1L); + curl_easy_setopt (db->curl, CURLOPT_MAXREDIRS, 50L); if (db->user != NULL) { diff --git a/src/curl_xml.c b/src/curl_xml.c index c0ab6fdb..c9f06518 100644 --- a/src/curl_xml.c +++ b/src/curl_xml.c @@ -842,6 +842,8 @@ static int cx_init_curl (cx_t *db) /* {{{ */ curl_easy_setopt (db->curl, CURLOPT_USERAGENT, COLLECTD_USERAGENT); curl_easy_setopt (db->curl, CURLOPT_ERRORBUFFER, db->curl_errbuf); curl_easy_setopt (db->curl, CURLOPT_URL, db->url); + curl_easy_setopt (db->curl, CURLOPT_FOLLOWLOCATION, 1L); + curl_easy_setopt (db->curl, CURLOPT_MAXREDIRS, 50L); if (db->user != NULL) { diff --git a/src/write_http.c b/src/write_http.c index d97bc9b5..eab1f617 100644 --- a/src/write_http.c +++ b/src/write_http.c @@ -134,6 +134,8 @@ static int wh_callback_init (wh_callback_t *cb) /* {{{ */ curl_easy_setopt (cb->curl, CURLOPT_ERRORBUFFER, cb->curl_errbuf); curl_easy_setopt (cb->curl, CURLOPT_URL, cb->location); + curl_easy_setopt (cb->curl, CURLOPT_FOLLOWLOCATION, 1L); + curl_easy_setopt (cb->curl, CURLOPT_MAXREDIRS, 50L); if (cb->user != NULL) { -- 2.11.0