Line | |
---|
1 | =begin
|
---|
2 | = $RCSfile$ -- SSL/TLS enhancement for Net::HTTP.
|
---|
3 |
|
---|
4 | = Info
|
---|
5 | 'OpenSSL for Ruby 2' project
|
---|
6 | Copyright (C) 2003 Blaz Grilc <[email protected]>
|
---|
7 | All rights reserved.
|
---|
8 |
|
---|
9 | = Licence
|
---|
10 | This program is licenced under the same licence as Ruby.
|
---|
11 | (See the file 'LICENCE'.)
|
---|
12 |
|
---|
13 | = Requirements
|
---|
14 |
|
---|
15 | = Version
|
---|
16 | $Id: ftptls.rb 11708 2007-02-12 23:01:19Z shyouhei $
|
---|
17 |
|
---|
18 | = Notes
|
---|
19 | Tested on FreeBSD 5-CURRENT and 4-STABLE
|
---|
20 | - ruby 1.6.8 (2003-01-17) [i386-freebsd5]
|
---|
21 | - OpenSSL 0.9.7a Feb 19 2003
|
---|
22 | - ruby-openssl-0.2.0.p0
|
---|
23 | tested on ftp server: glftpd 1.30
|
---|
24 | =end
|
---|
25 |
|
---|
26 | require 'socket'
|
---|
27 | require 'openssl'
|
---|
28 | require 'net/ftp'
|
---|
29 |
|
---|
30 | module Net
|
---|
31 | class FTPTLS < FTP
|
---|
32 | def login(user = "anonymous", passwd = nil, acct = nil)
|
---|
33 | ctx = OpenSSL::SSL::SSLContext.new('SSLv23')
|
---|
34 | ctx.key = nil
|
---|
35 | ctx.cert = nil
|
---|
36 | voidcmd("AUTH TLS")
|
---|
37 | @sock = OpenSSL::SSL::SSLSocket.new(@sock, ctx)
|
---|
38 | @sock.connect
|
---|
39 | super(user, passwd, acct)
|
---|
40 | voidcmd("PBSZ 0")
|
---|
41 | end
|
---|
42 | end
|
---|
43 | end
|
---|
Note:
See
TracBrowser
for help on using the repository browser.