# Net::HTTP.get2 failure when using debugger

**URL:** <https://www.ruby-forum.com/t/net-http-get2-failure-when-using-debugger/74706>\
**Category:** Ruby\
**Created:** [November 7, 2006, 10:53am UTC](https://www.ruby-forum.com/t/net-http-get2-failure-when-using-debugger/74706 "2006-11-07T10:53:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [November 7, 2006, 10:53am UTC](https://www.ruby-forum.com/t/net-http-get2-failure-when-using-debugger/74706/1 "2006-11-07T10:53:13Z")

</div>

Hi,  
Can someone tell me if I have found a bug or am doing something wrong  
using Net::HTTP.get ? If I run the code without the -rdebug flag, then  
it works perfectly. If I use the flag and then simply do a continue,  
then I get the errors shown after the code below. I have stepped  
through the code and shown that it is the get2 call that causes the  
error. Also happens with the get method.

Jeff

#!/usr/bin/ruby

require ‘net/http’

SITE = “[http://campus.acm.org](http://campus.acm.org)”  
PATH = ‘/Public/fmr/’  
USERAGENT = ’ Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en)  
AppleWebKit/418.9 (KHTML, like Gecko) Safari/419.3’  
http = Net::HTTP.new(‘[campus.acm.org](http://campus.acm.org)’,80)  
puts " "  
puts “First Get”  
headers = {  
‘Content-type’ =\> ‘application/x-www-form-urlencoded’,  
‘User-Agent’ =\> USERAGENT,  
‘Keep-Alive’ =\> ‘300’,  
‘Connection’ =\> ‘keep-alive’  
}  
resp, data = http.get2(PATH, headers)  
puts 'Code= ’ + resp.code

* * *

spartan[293]ruby -rdebug jtest1.rb  
Debug.rb  
Emacs support available.

jtest1.rb:3:require ‘net/http’  
(rdb:1) c

First Get  
/usr/local/lib/ruby/1.8/net/protocol.rb:133: `end of file reached' (EOFError) from /usr/local/lib/ruby/1.8/timeout.rb:76:in `timeout’  
from /usr/local/lib/ruby/1.8/net/protocol.rb:132:in `rbuf_fill' from /usr/local/lib/ruby/1.8/net/protocol.rb:104:in `read\_all’  
from /usr/local/lib/ruby/1.8/net/http.rb:2217:in `read_body_0' from /usr/local/lib/ruby/1.8/net/http.rb:2170:in `read\_body’  
from /usr/local/lib/ruby/1.8/net/http.rb:2195:in `body' from /usr/local/lib/ruby/1.8/net/http.rb:2134:in `reading\_body’  
from /usr/local/lib/ruby/1.8/net/http.rb:1049:in `request' from /usr/local/lib/ruby/1.8/net/http.rb:1034:in `request’  
from /usr/local/lib/ruby/1.8/net/http.rb:543:in `start' from /usr/local/lib/ruby/1.8/net/http.rb:1032:in `request’  
from /usr/local/lib/ruby/1.8/net/http.rb:945:in `get2’  
from jtest1.rb:17  
/usr/local/lib/ruby/1.8/net/protocol.rb:133: @rbuf \<\<  
@io.sysread(1024)
