From 3eedf9156cf01751423a99ef2939ec81964155d2 Mon Sep 17 00:00:00 2001 From: aamine Date: Sat, 6 Mar 2004 17:08:21 +0000 Subject: * lib/net/http.rb: spin off https code again. * lib/net/https.rb: new file. * ext/openssl/lib/net/https.rb: removed. moved to net/https with modifications. * ext/openssl/lib/net/protocol.rb: removed. merged with net/http. * lib/net/protocol.rb: new class BufferedIO. * lib/net/protocol.rb: InternetMessageIO < BufferedIO. * lib/net/protocol.rb: BufferedIO.new takes an IO. * lib/net/smtp.rb: follow InternetMessageIO's change. * lib/net/pop.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5908 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/net/smtp.rb | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'lib/net/smtp.rb') diff --git a/lib/net/smtp.rb b/lib/net/smtp.rb index 21c04812fe..123d31d205 100644 --- a/lib/net/smtp.rb +++ b/lib/net/smtp.rb @@ -1,17 +1,16 @@ # = net/smtp.rb -# +# #-- -# Copyright (c) 1999-2003 Yukihiro Matsumoto -# Copyright (c) 1999-2003 Minero Aoki +# Copyright (C) 1999-2004 Yukihiro Matsumoto +# Copyright (C) 1999-2004 Minero Aoki # -# written & maintained by Minero Aoki +# written and maintained by Minero Aoki # # This program is free software. You can re-distribute and/or -# modify this program under the same terms as Ruby itself, -# Ruby Distribute License or GNU General Public License. +# modify this program under the same terms as Ruby itself. # -# NOTE: You can find Japanese version of this document in -# the doc/net directory of the standard ruby interpreter package. +# NOTE: You can find Japanese version of this document at: +# http://www.ruby-lang.org/ja/man/index.cgi?cmd=view;name=net%2Fsmtp.rb # # $Id$ #++ @@ -120,7 +119,7 @@ require 'net/protocol' require 'digest/md5' - +require 'timeout' module Net # :nodoc: @@ -343,9 +342,12 @@ module Net # :nodoc: raise IOError, 'SMTP session already started' if @started check_auth_args user, secret, authtype if user or secret - @socket = InternetMessageIO.open(@address, @port, - @open_timeout, @read_timeout, - @debug_output) + @socket = InternetMessageIO.new(timeout(@open_timeout) { + TCPSocket.open(@address, @port) + }) + logging "SMTP session opened: #{@address}:#{@port}" + @socket.read_timeout = @read_timeout + @socket.debug_output = @debug_output check_response(critical { recv_response() }) begin if @esmtp @@ -629,6 +631,10 @@ module Net # :nodoc: end end + def logging(msg) + @debug_output << msg if @debug_output + end + end # class SMTP SMTPSession = SMTP -- cgit v1.2.3