In mail "[ruby-talk:19416] Re: PATCH: fixed bug in "waitfor" in net/telnet.rb"
Tobias Reif <tobiasreif / pinkjuice.com> wrote:
> this hangs forever:
> h = Net::HTTP.new(nil, 80)
> resp, data = h.get('/', nil)
> print data.length
It works on my box:
~/r/net $ unset RUBYLIB
~/r/net $ ruby-1.6.4 -v -rnet/http -e 'p Net::HTTP.new(nil,8080).get("/",nil)'
ruby 1.6.4 (2001-06-04) [i686-linux]
[#<Net::NetPrivate::HTTPResponse 200>, "<html>\n<head>\n <title>..."]
~/r/net $ ruby-1.7 -v -rnet/http -e 'p Net::HTTP.new(nil,8080).get("/",nil)'
ruby 1.7.1 (2001-08-06) [i686-linux]
#<Net::NetPrivate::HTTPResponse 200>
Net::HTTP tries to connect localhost when host is nil.
Please try the code below and let me know the result.
ruby exits normally, or hang?
$ ruby -rsocket -e 'TCPSocket.open(nil,80)'".
Minero Aoki