class Net::SSH::Proxy::HTTPS

A specialization of the HTTP proxy which encrypts the whole connection using OpenSSL. This has the advantage that proxy authentication information is not sent in plaintext.

Public Class Methods

new(proxy_host, proxy_port=80, options={}) click to toggle source

Create a new socket factory that tunnels via the given host and port. The options parameter is a hash of additional settings that can be used to tweak this proxy connection. In addition to the options taken by Net::SSH::Proxy::HTTP it supports:

  • :ssl_context => the SSL configuration to use for the connection

Calls superclass method Net::SSH::Proxy::HTTP.new
# File lib/net/ssh/proxy/https.rb, line 20
def initialize(proxy_host, proxy_port=80, options={})
  @ssl_context = options.delete(:ssl_context) ||
                   OpenSSL::SSL::SSLContext.new
  super(proxy_host, proxy_port, options)
end

Protected Instance Methods

establish_connection(connect_timeout) click to toggle source
# File lib/net/ssh/proxy/https.rb, line 41
def establish_connection(connect_timeout)
  plain_socket = super(connect_timeout)
  OpenSSL::SSL::SSLSocket.new(plain_socket, @ssl_context).tap do |socket|
    socket.extend(SSLSocketCompatibility)
    socket.connect
  end
end