1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/net/imap.rb (starttls): supported the STARTTLS command.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9122 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
shugo 2005-09-11 14:26:27 +00:00
parent 48a9b6170e
commit 51e25545ae
2 changed files with 22 additions and 0 deletions

View file

@ -1,3 +1,7 @@
Sun Sep 11 23:23:02 2005 Shugo Maeda <shugo@ruby-lang.org>
* lib/net/imap.rb (starttls): supported the STARTTLS command.
Sun Sep 11 22:18:07 2005 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
* bin/erb (ERB::Main#run): set ERB#filename so that it is used

View file

@ -322,6 +322,24 @@ module Net
send_command("LOGOUT")
end
# Sends a STARTTLS command to start TLS session.
def starttls(ctx = nil)
if @sock.kind_of?(OpenSSL::SSL::SSLSocket)
raise RuntimeError, "already using SSL"
end
send_command("STARTTLS") do |resp|
if resp.kind_of?(TaggedResponse) && resp.name == "OK"
if ctx
@sock = OpenSSL::SSL::SSLSocket.new(@sock, ctx)
else
@sock = OpenSSL::SSL::SSLSocket.new(@sock)
end
@sock.sync_close = true
@sock.connect
end
end
end
# Sends an AUTHENTICATE command to authenticate the client.
# The +auth_type+ parameter is a string that represents
# the authentication mechanism to be used. Currently Net::IMAP