Class: Bizside::ImplicitFTPS

Inherits:
Net::FTP
  • Object
show all
Defined in:
lib/bizside/implicit_ftps.rb

Constant Summary collapse

FTP_PORT =
990

Instance Method Summary collapse

Instance Method Details

#connect(host, port = FTP_PORT) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/bizside/implicit_ftps.rb', line 10

def connect(host, port = FTP_PORT)
  synchronize do
    @host = host
    @bare_sock = open_socket(host, port)
    begin
      ssl_sock = start_tls_session(Socket.tcp(host, port))
      @sock = BufferedSSLSocket.new(ssl_sock, read_timeout: @read_timeout)
      voidresp
      if @private_data_connection
        voidcmd("PBSZ 0")
        voidcmd("PROT P")
      end
    rescue OpenSSL::SSL::SSLError, Net::OpenTimeout
      @sock.close
      raise
    end
  end
end