mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
231247c010
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
43 lines
919 B
Ruby
43 lines
919 B
Ruby
=begin
|
|
= $RCSfile$ -- SSL/TLS enhancement for Net::HTTP.
|
|
|
|
= Info
|
|
'OpenSSL for Ruby 2' project
|
|
Copyright (C) 2003 Blaz Grilc <farmer@gmx.co.uk>
|
|
All rights reserved.
|
|
|
|
= Licence
|
|
This program is licenced under the same licence as Ruby.
|
|
(See the file 'LICENCE'.)
|
|
|
|
= Requirements
|
|
|
|
= Version
|
|
$Id$
|
|
|
|
= Notes
|
|
Tested on FreeBSD 5-CURRENT and 4-STABLE
|
|
- ruby 1.6.8 (2003-01-17) [i386-freebsd5]
|
|
- OpenSSL 0.9.7a Feb 19 2003
|
|
- ruby-openssl-0.2.0.p0
|
|
tested on ftp server: glftpd 1.30
|
|
=end
|
|
|
|
require 'socket'
|
|
require 'openssl'
|
|
require 'net/ftp'
|
|
|
|
module Net
|
|
class FTPTLS < FTP
|
|
def login(user = "anonymous", passwd = nil, acct = nil)
|
|
ctx = OpenSSL::SSL::SSLContext.new('SSLv23')
|
|
ctx.key = nil
|
|
ctx.cert = nil
|
|
voidcmd("AUTH TLS")
|
|
@sock = OpenSSL::SSL::SSLSocket.new(@sock, ctx)
|
|
@sock.connect
|
|
super(user, passwd, acct)
|
|
voidcmd("PBSZ 0")
|
|
end
|
|
end
|
|
end
|