bug-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#22273: “guix download” fails with “bad-response”


From: Ludovic Courtès
Subject: bug#22273: “guix download” fails with “bad-response”
Date: Tue, 05 Jan 2016 18:13:31 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Ricardo Wurmus <address@hidden> skribis:

> $ ./pre-inst-env guix download 
> https://bintray.com/artifact/download/groovy/maven/apache-groovy-src-2.4.5-incubating.zip
>
> Starting download of /tmp/guix-file.tllvrl
> From 
> https://bintray.com/artifact/download/groovy/maven/apache-groovy-src-2.4.5-incubating.zip...
> following redirection to 
> `https://dl.bintray.com/groovy/maven/apache-groovy-src-2.4.5-incubating.zip'...
> ERROR: Throw to key `bad-response' with args `("Bad Response-Line: ~s" 
> ("HTTP/1.1 302"))'.

The problem here is that the HTTP response seems to miss the “reason
phrase” as specified in
<http://www.w3.org/Protocols/rfc2616/rfc2616.txt>.

Or, to put it differently, it provides an empty reason phrase, which I
think is valid per the RFC, Section 6.1:

      Reason-Phrase  = *<TEXT, excluding CR, LF>

The problem is that (web http) strips trailing white space on the
response line, in its ‘read-line*’ procedure.  Changing
‘read-response-line’ to use ‘read-line’ (which does not strip trailing
space) instead of ‘read-line*’ fixes the problem.

I believe this is the right thing to do here.  Thoughts?

Thanks,
Ludo’.

diff --git a/module/web/http.scm b/module/web/http.scm
index 623008e..95e5d0f 100644
--- a/module/web/http.scm
+++ b/module/web/http.scm
@@ -1,6 +1,6 @@
 ;;; HTTP messages
 
-;; Copyright (C)  2010-2015 Free Software Foundation, Inc.
+;; Copyright (C)  2010-2016 Free Software Foundation, Inc.
 
 ;; This library is free software; you can redistribute it and/or
 ;; modify it under the terms of the GNU Lesser General Public
@@ -1155,7 +1155,7 @@ three values: the method, the URI, and the version."
   "Read the first line of an HTTP response from PORT, returning
 three values: the HTTP version, the response code, and the \"reason
 phrase\"."
-  (let* ((line (read-line* port))
+  (let* ((line (read-line port))
          (d0 (string-index line char-set:whitespace)) ; "delimiter zero"
          (d1 (and d0 (string-index line char-set:whitespace
                                    (skip-whitespace line d0)))))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]