mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
2eeb39b3cf
commit
e377a12bff
4 changed files with 51 additions and 9 deletions
17
ChangeLog
17
ChangeLog
|
@ -1,3 +1,20 @@
|
|||
Tue Sep 30 03:12:02 2003 Minero Aoki <aamine@loveruby.net>
|
||||
|
||||
* 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.
|
||||
|
||||
Tue Sep 30 02:54:49 2003 Minero Aoki <aamine@loveruby.net>
|
||||
|
||||
* test/ruby/test_iterator.rb: new test
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -415,7 +415,7 @@ module Net
|
|||
do_start account, password
|
||||
return yield(self)
|
||||
ensure
|
||||
finish
|
||||
do_finish
|
||||
end
|
||||
else
|
||||
do_start account, password
|
||||
|
@ -434,6 +434,8 @@ module Net
|
|||
@command.auth account, password
|
||||
end
|
||||
@started = true
|
||||
ensure
|
||||
do_finish if not @started
|
||||
end
|
||||
private :do_start
|
||||
|
||||
|
@ -443,13 +445,20 @@ module Net
|
|||
|
||||
# Finishes a POP3 session and closes TCP connection.
|
||||
def finish
|
||||
raise IOError, 'POP session not started yet' unless started?
|
||||
do_finish
|
||||
end
|
||||
|
||||
def do_finish
|
||||
@mails = nil
|
||||
@command.quit if @command
|
||||
ensure
|
||||
@started = false
|
||||
@command = nil
|
||||
@socket.close if @socket and not @socket.closed?
|
||||
@socket = nil
|
||||
@started = false
|
||||
end
|
||||
private :do_finish
|
||||
|
||||
def command
|
||||
raise IOError, 'POP session not opened yet' \
|
||||
|
|
|
@ -331,7 +331,7 @@ module Net # :nodoc:
|
|||
do_start(helo, user, secret, authtype)
|
||||
return yield(self)
|
||||
ensure
|
||||
finish
|
||||
do_finish
|
||||
end
|
||||
else
|
||||
do_start(helo, user, secret, authtype)
|
||||
|
@ -362,17 +362,28 @@ module Net # :nodoc:
|
|||
raise
|
||||
end
|
||||
authenticate user, secret, authtype if user
|
||||
@started = true
|
||||
ensure
|
||||
@socket.close if not @started and @socket and not @socket.closed?
|
||||
end
|
||||
private :do_start
|
||||
|
||||
# Finishes the SMTP session and closes TCP connection.
|
||||
# Raises IOError if not started.
|
||||
def finish
|
||||
raise IOError, 'not started yet' unless started?
|
||||
do_finish
|
||||
end
|
||||
|
||||
def do_finish
|
||||
quit if @socket and not @socket.closed? and not @error_occured
|
||||
ensure
|
||||
@started = false
|
||||
@error_occured = false
|
||||
@socket.close if @socket and not @socket.closed?
|
||||
@socket = nil
|
||||
@error_occured = false
|
||||
@started = false
|
||||
end
|
||||
private :do_finish
|
||||
|
||||
#
|
||||
# message send
|
||||
|
@ -623,4 +634,3 @@ module Net # :nodoc:
|
|||
SMTPSession = SMTP
|
||||
|
||||
end # module Net
|
||||
|
||||
|
|
Loading…
Reference in a new issue