summaryrefslogtreecommitdiff
path: root/lib/net/http.rb
diff options
context:
space:
mode:
authoraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-09-29 18:12:20 +0000
committeraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-09-29 18:12:20 +0000
commite377a12bff690512a568b93c018ec42961ac2a48 (patch)
treec8f8eaddf4a3869a297307b1c8374a0d5f29023e /lib/net/http.rb
parent2eeb39b3cf1b069f309126daed5cbec67ea3f616 (diff)
* lib/net/http.rb (finish): revert to 1.93.
* lib/net/pop.rb (finish): revert to 1.60. * lib/net/smtp.rb (finish): revert to 1.67. * lib/net/http.rb (do_start): ensure to close socket if failed to start session. * lib/net/pop.rb (do_start): ditto. * lib/net/smtp.rb (do_start): ditto. * lib/net/smtp.rb: SMTP#started? wrongly returned false always. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4628 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/net/http.rb')
-rw-r--r--lib/net/http.rb12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/net/http.rb b/lib/net/http.rb
index bb4934be6f..684e55f8db 100644
--- a/lib/net/http.rb
+++ b/lib/net/http.rb
@@ -416,7 +416,7 @@ module Net # :nodoc:
do_start
return yield(self)
ensure
- finish
+ do_finish
end
end
do_start
@@ -437,12 +437,18 @@ module Net # :nodoc:
private :on_connect
# Finishes HTTP session and closes TCP connection.
+ # Raises IOError if not started.
def finish
+ raise IOError, 'HTTP session not started yet' unless started?
+ do_finish
+ end
+
+ def do_finish
+ @started = false
@socket.close if @socket and not @socket.closed?
@socket = nil
- @started = false
- nil
end
+ private :do_finish
#
# proxy