diff options
author | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-05-22 10:50:54 +0000 |
---|---|---|
committer | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-05-22 10:50:54 +0000 |
commit | b6b1a387f1637aae55d9d7636d03db49b46ea75f (patch) | |
tree | 818ea9673eca2934917237ec2d5cfc29870be789 /lib | |
parent | 5fe5a24586ac9a698e0a9c8f0f6d4684e1d2609d (diff) |
merge revision(s) 26553:
* 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_7@27955 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 59e9c0c7f0..0f72b7ae9f 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 |