Ran into a web server with a broken header. Unfortunately, it's not one I have control of so I can't fix it. This problem seems to be ignored by the browsers I've tried, but not Net::HTTP. Here's what the header looks like,
HTTP/1.0 200 OK
Connection: close
Server: Microsoft-IIS/5.0
Expires: Fri, 08 Jul 2005 11:06:34 GMT
Last-Modified: Fri, 08 Jul 2005 11:06:34 GMT
: <------ problem line
Content-Type: Application/octet-stream
Content-Length: 57754
Content:
This causes Net::HTTP to raise a Net::HTTPBadResponse. The quick fix patch.
--- /usr/lib/ruby/1.8/net/http.rb Thu Dec 4 13:46:16 2003
+++ /usr/lib/ruby/1.8/net/http_modified.rb Fri Jul 8 11:28:29 2005
@@ -1574,7 +1574,7 @@
while true
line = sock.readuntil("\n", true).sub(/\s+\z/, '')
break if line.empty?
- m = /\A([^:]+):\s*/.match(line) or
+ m = /\A([^:]*):\s*/.match(line) or
raise HTTPBadResponse, 'wrong header line format'
yield m[1], m.post_match
end
···
Date: Fri, 08 Jul 2005 01:06:34 GMT