Bug #3955
closedUndefined method in net/http.rb Error on Exception
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
Updated by naruse (Yui NARUSE) about 14 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