GNU bug report logs - #22273
HTTP client rejects empty "reason phrase"

Previous Next

Package: guile;

Reported by: Ricardo Wurmus <ricardo.wurmus <at> mdc-berlin.de>

Date: Wed, 30 Dec 2015 14:23:01 UTC

Severity: normal

Found in version 2.0.11

Done: Andy Wingo <wingo <at> pobox.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 22273 in the body.
You can then email your comments to 22273 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#22273; Package guix. (Wed, 30 Dec 2015 14:23:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ricardo Wurmus <ricardo.wurmus <at> mdc-berlin.de>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Wed, 30 Dec 2015 14:23:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ricardo Wurmus <ricardo.wurmus <at> mdc-berlin.de>
To: <bug-guix <at> gnu.org>
Subject: “guix download” fails with
 “bad-response”
Date: Wed, 30 Dec 2015 15:21:54 +0100
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.




Changed bug title to 'HTTP client does not tolerate malformed HTTP response' from '“guix download” fails with “bad-response”' Request was from ludo <at> gnu.org (Ludovic Courtès) to control <at> debbugs.gnu.org. (Tue, 05 Jan 2016 16:58:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-guix <at> gnu.org:
bug#22273; Package guix. (Tue, 05 Jan 2016 17:14:01 GMT) Full text and rfc822 format available.

Message #10 received at 22273 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Ricardo Wurmus <ricardo.wurmus <at> mdc-berlin.de>
Cc: 22273 <at> debbugs.gnu.org
Subject: Re: bug#22273: “guix download” fails
 with “bad-response”
Date: Tue, 05 Jan 2016 18:13:31 +0100
[Message part 1 (text/plain, inline)]
Ricardo Wurmus <ricardo.wurmus <at> 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’.

[Message part 2 (text/x-patch, inline)]
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)))))

bug reassigned from package 'guix' to 'guile'. Request was from ludo <at> gnu.org (Ludovic Courtès) to control <at> debbugs.gnu.org. (Tue, 05 Jan 2016 17:16:01 GMT) Full text and rfc822 format available.

bug Marked as found in versions 2.0.11. Request was from ludo <at> gnu.org (Ludovic Courtès) to control <at> debbugs.gnu.org. (Tue, 05 Jan 2016 17:16:01 GMT) Full text and rfc822 format available.

Changed bug title to 'HTTP client rejects empty "reason phrase"' from 'HTTP client does not tolerate malformed HTTP response' Request was from ludo <at> gnu.org (Ludovic Courtès) to control <at> debbugs.gnu.org. (Wed, 06 Jan 2016 12:59:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-guile <at> gnu.org:
bug#22273; Package guile. (Wed, 06 Jan 2016 16:29:01 GMT) Full text and rfc822 format available.

Message #19 received at 22273 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Ricardo Wurmus <ricardo.wurmus <at> mdc-berlin.de>
Cc: 22273 <at> debbugs.gnu.org
Subject: Re: bug#22273: “guix download” fails
 with “bad-response”
Date: Wed, 06 Jan 2016 17:28:33 +0100
Fixed in Guile with commit 4c7732c.

This was a bit more work than just using ‘read-line’ because we want to
check that the line delimiter is present, like ‘read-line*’ did.

Thanks,
Ludo’.




Information forwarded to bug-guile <at> gnu.org:
bug#22273; Package guile. (Wed, 06 Jan 2016 16:41:01 GMT) Full text and rfc822 format available.

Message #22 received at 22273 <at> debbugs.gnu.org (full text, mbox):

From: Ricardo Wurmus <ricardo.wurmus <at> mdc-berlin.de>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 22273 <at> debbugs.gnu.org
Subject: Re: bug#22273: “guix download” fails
 with “bad-response”
Date: Wed, 6 Jan 2016 17:40:26 +0100
Ludovic Courtès <ludo <at> gnu.org> writes:

> Fixed in Guile with commit 4c7732c.
>
> This was a bit more work than just using ‘read-line’ because we want to
> check that the line delimiter is present, like ‘read-line*’ did.

Thank you!




Reply sent to Andy Wingo <wingo <at> pobox.com>:
You have taken responsibility. (Sun, 07 Aug 2016 11:15:01 GMT) Full text and rfc822 format available.

Notification sent to Ricardo Wurmus <ricardo.wurmus <at> mdc-berlin.de>:
bug acknowledged by developer. (Sun, 07 Aug 2016 11:15:01 GMT) Full text and rfc822 format available.

Message #27 received at 22273-done <at> debbugs.gnu.org (full text, mbox):

From: Andy Wingo <wingo <at> pobox.com>
To: 22273-done <at> debbugs.gnu.org
Subject: Re: bug#22273: “guix download” fails
 with “bad-response”
Date: Sun, 07 Aug 2016 13:14:13 +0200
On Wed 06 Jan 2016 17:28, ludo <at> gnu.org (Ludovic Courtès) writes:

> Fixed in Guile with commit 4c7732c.

Marking bug as closed




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 04 Sep 2016 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 7 years and 233 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.