summaryrefslogtreecommitdiff
path: root/guix/http-client.scm
diff options
context:
space:
mode:
authorMark H Weaver <mhw@netris.org>2015-02-18 19:33:10 -0500
committerMark H Weaver <mhw@netris.org>2015-02-19 03:32:22 -0500
commit04dec194d8e460831ec0695a944d9c7313affea2 (patch)
tree7b384927264e072da1211aff2a9c58b0ac606be1 /guix/http-client.scm
parente92a4ad928e869e98043f1f4afc7df20666bbf02 (diff)
downloadgnu-guix-04dec194d8e460831ec0695a944d9c7313affea2.tar
gnu-guix-04dec194d8e460831ec0695a944d9c7313affea2.tar.gz
download: Handle HTTP redirects to relative URI references.
Fixes <http://bugs.gnu.org/19840>. Reported by Ricardo Wurmus <rekado@elephly.net>. * guix/build/download.scm: On Guile 2.0.11 or earlier, redefine the http "Location" header to accept relative URIs. (resolve-uri-reference): New exported procedure. (http-fetch): Use 'resolve-uri-reference' to resolve redirections. * guix/http-client.scm (http-fetch): Use 'resolve-uri-reference'
Diffstat (limited to 'guix/http-client.scm')
-rw-r--r--guix/http-client.scm4
1 files changed, 3 insertions, 1 deletions
diff --git a/guix/http-client.scm b/guix/http-client.scm
index 4770628e45..aad7656e19 100644
--- a/guix/http-client.scm
+++ b/guix/http-client.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2012 Free Software Foundation, Inc.
;;;
;;; This file is part of GNU Guix.
@@ -29,6 +30,7 @@
#:use-module (rnrs bytevectors)
#:use-module (guix ui)
#:use-module (guix utils)
+ #:use-module ((guix build download) #:select (resolve-uri-reference))
#:export (&http-get-error
http-get-error?
http-get-error-uri
@@ -227,7 +229,7 @@ Raise an '&http-get-error' condition if downloading fails."
(values data len)))))
((301 ; moved permanently
302) ; found (redirection)
- (let ((uri (response-location resp)))
+ (let ((uri (resolve-uri-reference (response-location resp) uri)))
(close-port port)
(format #t (_ "following redirection to `~a'...~%")
(uri->string uri))