all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#22273: “guix download” fails with “bad-response”
@ 2015-12-30 14:21 Ricardo Wurmus
  2016-01-05 17:13 ` Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: Ricardo Wurmus @ 2015-12-30 14:21 UTC (permalink / raw)
  To: 22273

Downloading the source archive for the Groovy language with “guix
download” fails:

~~~~~~~~~~~~~~~~~~~~~~~
$ ./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"))'.
failed to download "/tmp/guix-file.tllvrl" from "https://bintray.com/artifact/download/groovy/maven/apache-groovy-src-2.4.5-incubating.zip"
guix download: error: https://bintray.com/artifact/download/groovy/maven/apache-groovy-src-2.4.5-incubating.zip: download failed
~~~~~~~~~~~~~~~~~~~~~~~

It works fine with wget.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#22273: “guix download” fails with “bad-response”
  2015-12-30 14:21 bug#22273: “guix download” fails with “bad-response” Ricardo Wurmus
@ 2016-01-05 17:13 ` Ludovic Courtès
  0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2016-01-05 17:13 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: 22273

[-- Attachment #1: Type: text/plain, Size: 1203 bytes --]

Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> 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’.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 916 bytes --]

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-01-05 17:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-30 14:21 bug#22273: “guix download” fails with “bad-response” Ricardo Wurmus
2016-01-05 17:13 ` Ludovic Courtès

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.