307 "Temporary Redirect" is not handled

  • Done
  • quality assurance status badge
Details
2 participants
  • Alex Kost
  • Ludovic Courtès
Owner
unassigned
Submitted by
Alex Kost
Severity
normal

Debbugs page

A
A
Alex Kost wrote on 12 Apr 2016 01:23
(address . bug-guix@gnu.org)
87a8kzz15a.fsf@gmail.com
As discovered by Albin Söderqvist (see the commentary in his 'openttd'
patch [1]), the following command fails:


with the following error:

Toggle snippet (7 lines)
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

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.

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(-)

Toggle diff (16 lines)
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
L
L
Ludovic Courtès wrote on 13 Apr 2016 13:35
(name . Alex Kost)(address . alezost@gmail.com)(address . 23275@debbugs.gnu.org)
87lh4hfds4.fsf@gnu.org
Alex Kost <alezost@gmail.com> skribis:

Toggle quote (13 lines)
> 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’.
A
A
Alex Kost wrote on 14 Apr 2016 01:07
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 23275@debbugs.gnu.org)
87zisw1ump.fsf@gmail.com
Ludovic Courtès (2016-04-13 23:35 +0300) wrote:

Toggle quote (19 lines)
> 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
A
A
Alex Kost wrote on 14 Apr 2016 01:08
control message for bug #23275
(address . control@debbugs.gnu.org)
87wpo01ukn.fsf@gmail.com
tags 23275 fixed
close 23275
?
Your comment

This issue is archived.

To comment on this conversation send an email to 23275@patchwise.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 23275
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch