summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--lib/net/pop.rb32
2 files changed, 31 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 6988d0c814..edb8780dbc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sun Mar 28 14:09:13 2004 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/pop.rb (auth): failed when account/password include "%".
+ [ruby-talk:95933]
+
Sat Mar 27 21:40:41 2004 Tanaka Akira <akr@m17n.org>
* (lib/open-uri.rb): permit extra semicolon in content-type field.
diff --git a/lib/net/pop.rb b/lib/net/pop.rb
index 278b949395..04c6544d24 100644
--- a/lib/net/pop.rb
+++ b/lib/net/pop.rb
@@ -196,11 +196,21 @@ module Net
# Class Parameters
#
- # The default port for POP3 connections, port 110
+ # The default port for POP3 connections, port 110.
def POP3.default_port
+ pop3_default_port()
+ end
+
+ # The default port for POP3 connections, port 110.
+ def POP3.pop3_default_port
110
end
+ # The default port for POP3s connections, port 995.
+ def POP3.pop3s_default_port
+ 995
+ end
+
def POP3.socket_type #:nodoc: obsolete
Net::InternetMessageIO
end
@@ -345,6 +355,8 @@ module Net
@mails = nil
@n_mails = nil
@n_bytes = nil
+
+ @use_ssl = false
end
# Does this instance use APOP authentication?
@@ -402,6 +414,12 @@ module Net
alias active? started? #:nodoc: obsolete
+ # Sets wheather we use SSL or not.
+ # You MUST require 'net/pops' before setting use_ssl=true.
+ def use_ssl?
+ false # redefined in net/pops
+ end
+
# Starts a POP3 session.
#
# When called with block, gives a POP3 object to the block and
@@ -425,9 +443,11 @@ module Net
end
def do_start( account, password )
- @socket = InternetMessageIO.new(timeout(@open_timeout) {
- TCPSocket.open(@address, @port)
- })
+ s = timeout(@open_timeout) { TCPSocket.open(@address, @port) }
+ if use_ssl?
+ s = OpenSSL::SSL::SSLSocket.open(s, @ssl_context)
+ end
+ @socket = InternetMessageIO.new(s)
logging "POP session started: #{@address}:#{@port} (#{@apop ? 'APOP' : 'POP'})"
@socket.read_timeout = @read_timeout
@socket.debug_output = @debug_output
@@ -748,8 +768,8 @@ module Net
def auth( account, password )
check_response_auth(critical {
- check_response_auth(get_response('USER ' + account))
- get_response('PASS ' + password)
+ check_response_auth(get_response('USER %s', account))
+ get_response('PASS %s', password)
})
end