From: Dan Schmidt Date: 2000-09-21T02:40:01+09:00 Subject: [ruby-talk:5033] Having problems with Net::HTTP::do_finish I just started using Ruby yesterday, and I'm having trouble with my first real program. The following minimal example demonstrates the problem I'm encountering: -- foo.rb -- require 'net/http' Net::HTTP.start ('www.ruby-lang.org') { |x| } -- results -- d:/src $ ruby foo.rb C:/APP/RUBY/lib/ruby/1.6/net/protocol.rb:578:in `sysread': End of file reached (EOFError) from C:/APP/RUBY/lib/ruby/1.6/net/protocol.rb:578:in `fill_rbuf' from C:/APP/RUBY/lib/ruby/1.6/net/protocol.rb:523:in `readuntil' from C:/APP/RUBY/lib/ruby/1.6/net/protocol.rb:533:in `readline' from C:/APP/RUBY/lib/ruby/1.6/net/http.rb:751:in `get_reply' from C:/APP/RUBY/lib/ruby/1.6/net/http.rb:626:in `get_response' from C:/APP/RUBY/lib/ruby/1.6/net/http.rb:359:in `connecting' from C:/APP/RUBY/lib/ruby/1.6/net/http.rb:299:in `head2' from C:/APP/RUBY/lib/ruby/1.6/net/http.rb:340:in `do_finish' from C:/APP/RUBY/lib/ruby/1.6/net/protocol.rb:179:in `finish' from C:/APP/RUBY/lib/ruby/1.6/net/protocol.rb:172:in `start' from C:/APP/RUBY/lib/ruby/1.6/net/http.rb:236:in `start' from foo.rb:3 d:/src $ ruby -v ruby 1.6.0 (2000-09-19) [i586-mswin32] (For what it's worth, http.rb and protocol.rb are both version 1.1.28.) The exception appears to occur upon closing the HTTP connection, in the implicit finish() when Net::Protocol::start() is used as an iterator. (The same thing happens if I call start() and finish() explicitly.) It appears to be attempting to close the connection with the following line head2 '/', { 'Connection' => 'close' } and failing when it doesn't receive a response. I don't yet understand HTTP (and protocol.rb and http.rb) enough to immediately know where the problem lies (e.g., is it unexpected behavior to encounter EOF upon closing a connection?). Any pointers would be appreciated. -- Dan Schmidt | http://www.dfan.org Honest Bob CD now available! | http://www.dfan.org/honestbob/cd.html