[BUG] Net::HTTP closed stream (IOError)

D

daz

Hi,

With this script on Win98se ...

printf("ruby %s (%s) [%s]\n", RUBY_VERSION, RUBY_RELEASE_DATE, RUBY_PLATFORM)

require 'net/http'
p [Net::HTTP::Revision, Net::HTTP::HTTPVersion]
h = Net::HTTP.new('www.rubyist.net')
resp = h.get('/index.html', nil) # line 10
puts resp.body

.... I get ...


ruby 1.8.0 (2003-08-30) [i586-bccwin32]
["1.97", "1.1"]
D:/RUBY/SRC_INST_2/lib/ruby/1.8/net/protocol.rb:92:in `close': closed stream (IOError)
from D:/RUBY/SRC_INST_2/lib/ruby/1.8/net/protocol.rb:92:in `close'
from D:/RUBY/SRC_INST_2/lib/ruby/1.8/net/http.rb:449:in `do_finish'
from D:/RUBY/SRC_INST_2/lib/ruby/1.8/net/http.rb:420:in `start'
from D:/RUBY/SRC_INST_2/lib/ruby/1.8/net/http.rb:822:in `request'
from D:/RUBY/SRC_INST_2/lib/ruby/1.8/net/http.rb:616:in `get'
from C:/TEMP/rb3205.TMP:7


If I rescue inside protocol.rb - InternetMessageIO#close ...
begin
p @socket
@socket.close
rescue => e # DfB
puts e.message
puts e.backtrace
end

....

ruby 1.8.0 (2003-08-30) [i586-bccwin32]
["1.97", "1.1"]
#<TCPSocket:0x313b4dc>
Unknown Error
D:/RUBY/SRC_INST_2/lib/ruby/1.8/net/protocol.rb:93:in `close'
D:/RUBY/SRC_INST_2/lib/ruby/1.8/net/protocol.rb:93:in `close'
D:/RUBY/SRC_INST_2/lib/ruby/1.8/net/http.rb:871:in `end_transport'
D:/RUBY/SRC_INST_2/lib/ruby/1.8/net/http.rb:836:in `request'
D:/RUBY/SRC_INST_2/lib/ruby/1.8/net/http.rb:821:in `request'
D:/RUBY/SRC_INST_2/lib/ruby/1.8/net/http.rb:819:in `start'
D:/RUBY/SRC_INST_2/lib/ruby/1.8/net/http.rb:822:in `request'
D:/RUBY/SRC_INST_2/lib/ruby/1.8/net/http.rb:616:in `get'
C:/TEMP/rb3205.TMP:7
"<html>\n<head>\n<title>www.rubyist.net</title>\n</head>\n<body>\n<p>\nHello world.\n</p>\n</body>\n"

.... the data is there, OK.


Any ideas ?


daz
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top