This seems bizar, the first get_response() to apple.com goes fine, the
2nd hangs indefinitely. It hangs on two different machines in different
network segments.
require 'net/http'
require 'uri'
response = Net::HTTP.get_response( URI.parse('http://www.apple.com') )
puts response.class # Net::HTTPOK
puts response.code # 200
response = Net::HTTP.get_response(
URI.parse('http://content.digitalwell.washington.edu/isilon/1/8/45/459ffc6f-3f91-46f5-af58-155791dad3b4.mp3')
)
puts response.class
puts response.code
(I have no affiliation with the hanging url, it's just a url to I came
across in my server logs while processing RSS feed enclosures).
Pressing ctrl-c gives:
/opt/ruby-1.8.4/lib/ruby/1.8/net/protocol.rb:133:in `sysread': Interrupt
from /opt/ruby-1.8.4/lib/ruby/1.8/net/protocol.rb:133:in
`rbuf_fill'
from /opt/ruby-1.8.4/lib/ruby/1.8/timeout.rb:56:in `timeout'
from /opt/ruby-1.8.4/lib/ruby/1.8/timeout.rb:76:in `timeout'
from /opt/ruby-1.8.4/lib/ruby/1.8/net/protocol.rb:132:in
`rbuf_fill'
from /opt/ruby-1.8.4/lib/ruby/1.8/net/protocol.rb:86:in `read'
from /opt/ruby-1.8.4/lib/ruby/1.8/net/http.rb:2180:in
`read_body_0'
from /opt/ruby-1.8.4/lib/ruby/1.8/net/http.rb:2141:in
`read_body'
from /opt/ruby-1.8.4/lib/ruby/1.8/net/http.rb:2166:in `body'
from /opt/ruby-1.8.4/lib/ruby/1.8/net/http.rb:2105:in
`reading_body'
from /opt/ruby-1.8.4/lib/ruby/1.8/net/http.rb:1048:in `request'
from /opt/ruby-1.8.4/lib/ruby/1.8/net/http.rb:944:in
`request_get'
from /opt/ruby-1.8.4/lib/ruby/1.8/net/http.rb:380:in
`get_response'
from /opt/ruby-1.8.4/lib/ruby/1.8/net/http.rb:545:in `start'
from /opt/ruby-1.8.4/lib/ruby/1.8/net/http.rb:379:in
`get_response'
from test.rb:8
Anyone?
···
--
Posted via http://www.ruby-forum.com/.