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
"\n\nwww.rubyist.net\n\n\n
\nHello world.\n
\n\n"… the data is there, OK.
Any ideas ?
daz