aboutsummaryrefslogtreecommitdiffstats
path: root/lib/net/smtp.rb
diff options
context:
space:
mode:
authoraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-03-06 17:08:21 +0000
committeraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-03-06 17:08:21 +0000
commit3eedf9156cf01751423a99ef2939ec81964155d2 (patch)
tree9cc29f6a4e68821dcdaa57058bf44871bcd4fd8c /lib/net/smtp.rb
parentdd53813e38e2839b08cc540df6296c392dbf3c25 (diff)
downloadruby-3eedf9156cf01751423a99ef2939ec81964155d2.tar.gz
* 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
Diffstat (limited to 'lib/net/smtp.rb')
-rw-r--r--lib/net/smtp.rb30
1 files changed, 18 insertions, 12 deletions
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 <aamine@loveruby.net>
+# written and maintained by Minero Aoki <aamine@loveruby.net>
#
# 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