Code

ensure all curl-based plugins follow HTTP redirects
authorMarc Fournier <marc.fournier@camptocamp.com>
Fri, 16 Jan 2015 22:45:26 +0000 (23:45 +0100)
committerMarc Fournier <marc.fournier@camptocamp.com>
Fri, 16 Jan 2015 22:45:26 +0000 (23:45 +0100)
For the sake of consistency.

src/curl_json.c
src/curl_xml.c
src/write_http.c

index b79c999e2d8bf51116cf1e618a7229843c364f6d..09db7866fa8bdbc3465184c6820e38e3a94ee868 100644 (file)
@@ -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)
   {
index c0ab6fdbed7721374ccbff5e180dce6e897a7690..c9f06518ba1db2499031bc9b66ba262a73567b6d 100644 (file)
@@ -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)
   {
index d97bc9b52ce9fde8b736d80d31bb0ede208f9f70..eab1f617626123c5ba14893532d60c2960891c02 100644 (file)
@@ -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)
         {