[ruby-core:24459] [Bug #1796] open-uri doesn't support multiline server headers

View: New views
4 Messages — Rating Filter:   Alert me  

[ruby-core:24459] [Bug #1796] open-uri doesn't support multiline server headers

by Matthew Boedicker :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Bug #1796: open-uri doesn't support multiline server headers
http://redmine.ruby-lang.org/issues/show/1796

Author: Manuel Carrasco
Status: Open, Priority: High
ruby -v: ruby 1.8.7 (2008-05-31 patchlevel 0) [i686-linux]

When a server sends a multiline header, open-uri raises an exception with the message 'wrong header line format'.

Multi-line headers are valid since RFC 2616 says: 'Each header field consists of a name followed by a colon (":") and the field value. Field names are case-insensitive. The field value MAY be preceded by any amount of LWS, though a single SP is preferred. Header fields can be extended over multiple lines by preceding each extra line with at least one SP or HT'.

The problem is in the line 2034 of net/http.rb where the code handles response headers. It reads bytes until a new line character is detected and expects each header in one line. Nonetheless it has to read until a line followed by a non space/tab character is detected.


----------------------------------------
http://redmine.ruby-lang.org


[ruby-core:24460] unsubscribe

by Steve Dame-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

unsubscribe

[ruby-core:25248] [Bug #1796] open-uri doesn't support multiline server headers

by Matthew Boedicker :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Issue #1796 has been updated by Manuel Carrasco.

File open_uri_multiline_headers.patch added

I attach a patch that fixes this bug.
The patch makes extra header lines be ignored.

Thanks

----------------------------------------
http://redmine.ruby-lang.org/issues/show/1796

----------------------------------------
http://redmine.ruby-lang.org


[ruby-core:26435] [Bug #1796] open-uri doesn't support multiline server headers

by Matthew Boedicker :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Issue #1796 has been updated by Hiroshi NAKAMURA.


I fixed the bug of net/http at r25577.

Manuel, would you please post the actual HTTP response header that caused the problem?
I added some tests but I want to ensure the problem won't happen again for you.
Thanks in advance.
----------------------------------------
http://redmine.ruby-lang.org/issues/show/1796

----------------------------------------
http://redmine.ruby-lang.org