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/pop.rb | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'lib/net/pop.rb') diff --git a/lib/net/pop.rb b/lib/net/pop.rb index 5ada68fd4d..278b949395 100644 --- a/lib/net/pop.rb +++ b/lib/net/pop.rb @@ -1,17 +1,17 @@ # = net/pop.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. +# Ruby Distribute License. # -# 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%2Fpop.rb # # $Id$ #++ @@ -168,6 +168,7 @@ require 'net/protocol' require 'digest/md5' +require 'timeout' module Net @@ -424,8 +425,12 @@ module Net end def do_start( account, password ) - @socket = self.class.socket_type.open(@address, @port, - @open_timeout, @read_timeout, @debug_output) + @socket = InternetMessageIO.new(timeout(@open_timeout) { + TCPSocket.open(@address, @port) + }) + logging "POP session started: #{@address}:#{@port} (#{@apop ? 'APOP' : 'POP'})" + @socket.read_timeout = @read_timeout + @socket.debug_output = @debug_output on_connect @command = POP3Command.new(@socket) if apop? @@ -558,6 +563,10 @@ module Net end end + def logging(msg) + @debug_output << msg if @debug_output + end + end # class POP3 # class aliases -- cgit v1.2.3