Project

General

Profile

Actions

Bug #3955

closed

Undefined method in net/http.rb Error on Exception

Added by e4t (Egbert Eich) over 13 years ago. Updated about 13 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 1.8.7 (2010-01-10 patchlevel 249)
[ruby-core:32829]

Description

=begin
If request() (net/http.rb) gets an exception (for instance an EOF error in start()) I get an error:
/usr/lib64/ruby/1.8/net/http.rb:1067:in request': undefined method closed?' for nil:NilClass (NoMethodError)
Reason: request() calls itself recursively in the block to 'start'. On an exception the rescue block of the inner call to request() is executed which raises the exception again then in the ensure block of start() @socked is nil-ed. However since the exception has been raised again the exception block of the outer request() call gets called after that. Since @socket has already been nil-ed the above error occurs.
The fix is simple, see attached file.
I suspect the bug still exists in 1.9 (as presently in HEAD in github). The code in question has been moved to transport_request() now but the execution sequence remains largely unchanged.
=end


Files

diff.http.rb (351 Bytes) diff.http.rb e4t (Egbert Eich), 10/17/2010 10:11 PM
Actions #1

Updated by naruse (Yui NARUSE) over 13 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
This issue was solved with changeset r29524.
Egbert, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

=end

Actions

Also available in: Atom PDF

Like0
Like0