* bug#23275: 307 "Temporary Redirect" is not handled
@ 2016-04-12 8:23 Alex Kost
2016-04-13 20:35 ` Ludovic Courtès
0 siblings, 1 reply; 3+ messages in thread
From: Alex Kost @ 2016-04-12 8:23 UTC (permalink / raw)
To: 23275
[-- Attachment #1: Type: text/plain, Size: 1246 bytes --]
As discovered by Albin Söderqvist (see the commentary in his 'openttd'
patch [1]), the following command fails:
guix download http://binaries.openttd.org/releases/1.6.0/openttd-1.6.0-source.tar.xz
with the following error:
--8<---------------cut here---------------start------------->8---
Starting download of /tmp/guix-file.sYMDJZ
From http://binaries.openttd.org/releases/1.6.0/openttd-1.6.0-source.tar.xz...
ERROR: download failed "http://binaries.openttd.org/releases/1.6.0/openttd-1.6.0-source.tar.xz" 307 "Temporary Redirect"
failed to download "/tmp/guix-file.sYMDJZ" from "http://binaries.openttd.org/releases/1.6.0/openttd-1.6.0-source.tar.xz"
guix download: error: http://binaries.openttd.org/releases/1.6.0/openttd-1.6.0-source.tar.xz: download failed
--8<---------------cut here---------------end--------------->8---
This happens because 'http-fetch' procedure from (guix build download)
module handles only 301 and 302 codes, while here we have 307 [2] [3].
The attached patch fixes this problem.
[1] http://lists.gnu.org/archive/html/guix-devel/2016-04/msg00445.html
[2] https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#3xx_Redirection
[3] https://tools.ietf.org/html/rfc2616#section-10.3.8
[-- Attachment #2: 0001-download-Follow-HTTP-307-Temporary-Redirection.patch --]
[-- Type: text/x-patch, Size: 1336 bytes --]
From d0ee21dd4e8c34e7d3f23eb69943026706d24d37 Mon Sep 17 00:00:00 2001
From: Alex Kost <alezost@gmail.com>
Date: Tue, 12 Apr 2016 11:14:59 +0300
Subject: [PATCH] download: Follow HTTP 307 "Temporary Redirection".
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Reported by Albin Söderqvist <albin@fripost.org>.
* guix/build/download.scm (http-fetch): Follow redirections upon 307.
This is what 'binaries.openttd.org' does.
---
guix/build/download.scm | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/guix/build/download.scm b/guix/build/download.scm
index 0568800..fb236d3 100644
--- a/guix/build/download.scm
+++ b/guix/build/download.scm
@@ -530,7 +530,8 @@ Return the resulting target URI."
(put-bytevector p bv-or-port))))
file))
((301 ; moved permanently
- 302) ; found (redirection)
+ 302 ; found (redirection)
+ 307) ; temporary redirection
(let ((uri (resolve-uri-reference (response-location resp) uri)))
(format #t "following redirection to `~a'...~%"
(uri->string uri))
--
2.7.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* bug#23275: 307 "Temporary Redirect" is not handled
2016-04-12 8:23 bug#23275: 307 "Temporary Redirect" is not handled Alex Kost
@ 2016-04-13 20:35 ` Ludovic Courtès
2016-04-14 8:07 ` Alex Kost
0 siblings, 1 reply; 3+ messages in thread
From: Ludovic Courtès @ 2016-04-13 20:35 UTC (permalink / raw)
To: Alex Kost; +Cc: 23275
Alex Kost <alezost@gmail.com> skribis:
> From d0ee21dd4e8c34e7d3f23eb69943026706d24d37 Mon Sep 17 00:00:00 2001
> From: Alex Kost <alezost@gmail.com>
> Date: Tue, 12 Apr 2016 11:14:59 +0300
> Subject: [PATCH] download: Follow HTTP 307 "Temporary Redirection".
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
>
> Reported by Albin Söderqvist <albin@fripost.org>.
>
> * guix/build/download.scm (http-fetch): Follow redirections upon 307.
> This is what 'binaries.openttd.org' does.
Sure, please push!
(Please add “Fixes …” in the commit log.)
Thanks!
Ludo’.
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#23275: 307 "Temporary Redirect" is not handled
2016-04-13 20:35 ` Ludovic Courtès
@ 2016-04-14 8:07 ` Alex Kost
0 siblings, 0 replies; 3+ messages in thread
From: Alex Kost @ 2016-04-14 8:07 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: 23275
Ludovic Courtès (2016-04-13 23:35 +0300) wrote:
> Alex Kost <alezost@gmail.com> skribis:
>
>> From d0ee21dd4e8c34e7d3f23eb69943026706d24d37 Mon Sep 17 00:00:00 2001
>> From: Alex Kost <alezost@gmail.com>
>> Date: Tue, 12 Apr 2016 11:14:59 +0300
>> Subject: [PATCH] download: Follow HTTP 307 "Temporary Redirection".
>> MIME-Version: 1.0
>> Content-Type: text/plain; charset=UTF-8
>> Content-Transfer-Encoding: 8bit
>>
>> Reported by Albin Söderqvist <albin@fripost.org>.
>>
>> * guix/build/download.scm (http-fetch): Follow redirections upon 307.
>> This is what 'binaries.openttd.org' does.
>
> Sure, please push!
>
> (Please add “Fixes …” in the commit log.)
Done and committed as 82fd23b.
--
Alex
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-04-14 8:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-12 8:23 bug#23275: 307 "Temporary Redirect" is not handled Alex Kost
2016-04-13 20:35 ` Ludovic Courtès
2016-04-14 8:07 ` Alex Kost
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).