From: hemant Date: 2010-02-18T23:20:38+09:00 Subject: Re: Exception change with net/http in Ruby 187 PL 248/9 Hi, On Thu, Feb 18, 2010 at 6:19 AM, Mitch Williams wrote: > Ran into the following problem with net http in Ruby 187 pl248 > > require net/http.rb > n = Net::HTTP.new('server-that-is-not-listening-on-port-eighty') > n.request_head('/') > > Prior to this change: > http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=25851 the > above code results in an: > > Errno::ECONNREFUSED: Connection refused - connect(2) > > > After the change I receive: > > NoMethodError: undefined method `closed?' for nil:NilClass > > > From line 1060 of net/http.rb.  It looks like the code was intended to close > sockets in the event of an error, but it assumes the socket actually exists. > > Can anyone else reproduce this issue? > Yes, I can reproduce. Indeed, this looks like unintentional change to me and somewhat unintuitive. I think, you should file a report on Redmine for this or raise it on ruby-core mailing list.