summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-10-19 12:07:26 +0200
committerLudovic Courtès <ludo@gnu.org>2014-10-19 12:07:53 +0200
commit38bf090e7c3952bb30707fe544987cccc85b8677 (patch)
tree8d8dee47b1c657a525de8dbc0f197f69a6bb62b7
parentd99e12d24750bff2bcf437906f281afdd844a72b (diff)
downloadguix-38bf090e7c3952bb30707fe544987cccc85b8677.tar.gz
download: Add "Accept: */*" to the headers.
Fixes downloads from https://alioth.debian.org.
Reported by John Darrington <jmd@gnu.org>.

* guix/build/download.scm (http-fetch)[headers]: Add 'Accept'.
-rw-r--r--guix/build/download.scm14
1 files changed, 9 insertions, 5 deletions
diff --git a/guix/build/download.scm b/guix/build/download.scm
index c081f3b29b..26b497d458 100644
--- a/guix/build/download.scm
+++ b/guix/build/download.scm
@@ -212,10 +212,14 @@ which is not available during bootstrap."
         (string>? (version) "2.0.7")))
 
   (define headers
-    ;; Some web sites, such as http://dist.schmorp.de, would block you if
-    ;; there's no 'User-Agent' header, presumably on the assumption that
-    ;; you're a spammer.  So work around that.
-    '((User-Agent . "GNU Guile")))
+    '(;; Some web sites, such as http://dist.schmorp.de, would block you if
+      ;; there's no 'User-Agent' header, presumably on the assumption that
+      ;; you're a spammer.  So work around that.
+      (User-Agent . "GNU Guile")
+
+      ;; Some servers, such as https://alioth.debian.org, return "406 Not
+      ;; Acceptable" when not explicitly told that everything is accepted.
+      (Accept . "*/*")))
 
   (let*-values (((connection)
                  (open-connection-for-uri uri))
@@ -246,7 +250,7 @@ which is not available during bootstrap."
              (if (port? bv-or-port)
                  (begin
                    (dump-port bv-or-port p
-                              #:buffer-size 65536  ; don't flood the log
+                              #:buffer-size 65536 ; don't flood the log
                               #:progress (progress-proc (uri-abbreviation uri)
                                                         size))
                    (newline))