diff options
| author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-02-03 12:15:02 +0000 |
|---|---|---|
| committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-02-03 12:15:02 +0000 |
| commit | 5facf7e22f0c0397827c8fcb74aad74ff3adbaa2 (patch) | |
| tree | 675678d7639b174bcb5dc397c23e6406e4d5e15e /lib | |
| parent | f81cdb36abe93a029c8c1f7d7a96dfa019abfb49 (diff) | |
* lib/net/http.rb (Net::HTTP#request): close @socket only after
started. [ruby-core:28028]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@26553 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/net/http.rb | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/net/http.rb b/lib/net/http.rb index 5e1abcf500..142248d3dc 100644 --- a/lib/net/http.rb +++ b/lib/net/http.rb @@ -1044,7 +1044,8 @@ module Net #:nodoc: end req.set_body_internal body - begin_transport req + begin + begin_transport req req.exec @socket, @curr_http_version, edit_path(req.path) begin res = HTTPResponse.read_new(@socket) @@ -1052,13 +1053,14 @@ module Net #:nodoc: res.reading_body(@socket, req.response_body_permitted?) { yield res if block_given? } - end_transport req, res + end_transport req, res + rescue => exception + D "Conn close because of error #{exception}" + @socket.close unless @socket.closed? + raise exception + end res - rescue => exception - D "Conn close because of error #{exception}" - @socket.close unless @socket.closed? - raise exception end private |
