aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-02-16 13:55:43 +0100
committerEelco Dolstra <edolstra@gmail.com>2017-02-16 13:55:43 +0100
commit40f0e3b366458a6f1bc09a366a218abf13a1af1e (patch)
treec31afb8a71f7b40537deb09a155c605765a834be
parentd1139ff36b5df48ddf76600ad17e59a9d1dcd46a (diff)
Include "curl" in the User-Agent header
Some sites (e.g. BitBucket) give a helpful 401 error when trying to download a private archive if the User-Agent contains "curl", but give a redirect to a login page otherwise (so for instance "nix-prefetch-url" will succeed but produce useless output).
-rw-r--r--src/libstore/download.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libstore/download.cc b/src/libstore/download.cc
index f93fb1e96..d65ac7b87 100644
--- a/src/libstore/download.cc
+++ b/src/libstore/download.cc
@@ -201,7 +201,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_NOSIGNAL, 1);
- curl_easy_setopt(req, CURLOPT_USERAGENT, ("Nix/" + nixVersion).c_str());
+ curl_easy_setopt(req, CURLOPT_USERAGENT, ("curl/" LIBCURL_VERSION " Nix/" + nixVersion).c_str());
#if LIBCURL_VERSION_NUM >= 0x072b00
curl_easy_setopt(req, CURLOPT_PIPEWAIT, 1);
#endif