I think you guys are having the same problem with windows and zone  
alarm that some people were having on the rails list. Zone alarm  
keeps ruby from working with sockets correctly. The only way they  
fixed this was by uninstalling zone alarm. Just turning it off didn't  
work but uninstalling it let ruby have its sockets back.

-Ezra
On Jul 9, 2005, at 9:40 PM, daz wrote:

>
> Ken Kaplan wrote:
>
>>
>> [...]
>>
>> It hangs when writing the get request string to a TCPsocket object.
>>
>> Does anyone know why this might fail without raising an exception?
>> Any suggestions appreciated...
>>
>>
>
> I can't help, unfortunately.
> I added -
>
>   h.set_debug_output $stdout   # right after Net::HTTP.new
>
> and got -
>
>   opening connection to www.pragmaticprogrammer.com...
>   opened
>   <- "GET /index.html HTTP/1.1\r\nConnection: close\r\nHost:  
> www.pragmaticprogrammer.com\r\n\r\n"
>   -> "HTTP/1.1 200 OK\r\n"
>   -> "Date: Sun, 10 Jul 2005 01:36:29 GMT\r\n"
>   [...]
>
> and (from your trace, thanks) you will be getting -
>
>   opening connection to www.pragmaticprogrammer.com...
>   opened
>   [HANG]
>
> (It's surprising that it doesn't time out, though.)
>
> All I can suggest is that you try with a local server.
> If you set this going in the background, you should
> get a response from your browser at http://127.0.0.1/webrick :
>
>                   <servlet.rb>
> #-------------------------------------------------
> require 'webrick'
> include WEBrick
>
> # Browser address: http://127.0.0.1/webrick
>
> s = HTTPServer.new( :Port => 80 )
>
> class HelloServlet < HTTPServlet::AbstractServlet
>   def do_GET(req, res)
>     # show request in response !
>     res.body = req.to_s
>     res['Content-Type'] = "text/plain"
>   end
> end
> s.mount('/webrick', HelloServlet)
>
> trap("INT") { s.shutdown }
> STDOUT.sync=true
> puts ' '*30 << '**********************************'
> puts ' '*30 << '==  Ctrl+Break to close server  =='
> puts ' '*30 << '**********************************'
> s.start
> #-------------------------------------------------
>
> Then, if everything is OK of course, you could access
> it from another Ruby session with your modified script:
>
> #-------------------------------------------------
> STDOUT.sync=true
> require 'net/http'
>
> h = Net::HTTP.new('127.0.0.1', 80)
> h.set_debug_output STDOUT
> resp, data = h.get('/webrick/xyz', nil)
>
> puts '*'*30
> if resp.message =~ /\AOK/
>   print data
> else
>   puts 'ERROR ...'
>   p resp.message
> end
> puts '*'*30
> #-------------------------------------------------
>
>
> It does seem like a problem you've got locally rather than
> Ruby's Net library.  Please post back if you find the cause
> or suspect 'Net' is at fault.
>
> Good luck,
>
> daz
>
>
>
>

-Ezra Zygmuntowicz
WebMaster
Yakima Herald-Republic Newspaper
ezra / yakima-herald.com
509-577-7732