about summary refs log tree commit diff
path: root/src/libstore/download.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2018-06-18T08·36+0200
committerEelco Dolstra <edolstra@gmail.com>2018-06-18T08·36+0200
commitb920b908578d68c7c80f1c1e89c42784693e18d5 (patch)
tree3b3b9e2680aaa3c2d24ef07e9d288197ae0f5b8f /src/libstore/download.cc
parent2e244fb68fc222dbca99572f5cfdea5619225a21 (diff)
Detect redirect loops
Fixes #2225.
Diffstat (limited to 'src/libstore/download.cc')
-rw-r--r--src/libstore/download.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/libstore/download.cc b/src/libstore/download.cc
index 7a5deed32143..07acd5d0e004 100644
--- a/src/libstore/download.cc
+++ b/src/libstore/download.cc
@@ -244,6 +244,7 @@ struct CurlDownloader : public Downloader
 
             curl_easy_setopt(req, CURLOPT_URL, request.uri.c_str());
             curl_easy_setopt(req, CURLOPT_FOLLOWLOCATION, 1L);
+            curl_easy_setopt(req, CURLOPT_MAXREDIRS, 10);
             curl_easy_setopt(req, CURLOPT_NOSIGNAL, 1);
             curl_easy_setopt(req, CURLOPT_USERAGENT,
                 ("curl/" LIBCURL_VERSION " Nix/" + nixVersion +
@@ -364,6 +365,7 @@ struct CurlDownloader : public Downloader
                         case CURLE_INTERFACE_FAILED:
                         case CURLE_UNKNOWN_OPTION:
                         case CURLE_SSL_CACERT_BADFILE:
+                        case CURLE_TOO_MANY_REDIRECTS:
                             err = Misc;
                             break;
                         default: // Shut up warnings