In Files

  • drb/ssl.rb

DRb::DRbSSLSocket

The protocol for DRb over an SSL socket

The URI for a DRb socket over SSL is: drbssl://<host>:<port>?<option>. The option is optional

Public Class Methods

new(uri, soc, config, is_established) click to toggle source

Create a DRb::DRbSSLSocket instance.

uri is the URI we are connected to. soc is the tcp socket we are bound to. config is our configuration. Either a Hash or SSLConfig is_established is a boolean of whether soc is currently established

This is called automatically based on the DRb protocol.

 
               # File drb/ssl.rb, line 303
def initialize(uri, soc, config, is_established)
  @ssl = is_established ? soc : nil
  super(uri, soc.to_io, config)
end
            
open(uri, config) click to toggle source

Return an DRb::DRbSSLSocket instance as a client-side connection, with the SSL connected. This is called from DRb.start_service or while connecting to a remote object:

DRb.start_service 'drbssl://localhost:0', front, config

uri is the URI we are connected to, 'drbssl://localhost:0' above, config is our configuration. Either a Hash or DRb::DRbSSLSocket::SSLConfig

 
               # File drb/ssl.rb, line 248
def self.open(uri, config)
  host, port, = parse_uri(uri)
  soc = TCPSocket.open(host, port)
  ssl_conf = SSLConfig::new(config)
  ssl_conf.setup_ssl_context
  ssl = ssl_conf.connect(soc)
  self.new(uri, ssl, ssl_conf, true)
end
            
open_server(uri, config) click to toggle source

Returns a DRb::DRbSSLSocket instance as a server-side connection, with the SSL connected. This is called from DRb.start_service or while connecting to a remote object:

DRb.start_service 'drbssl://localhost:0', front, config

uri is the URI we are connected to, 'drbssl://localhost:0' above, config is our configuration. Either a Hash or DRb::DRbSSLSocket::SSLConfig

 
               # File drb/ssl.rb, line 266
def self.open_server(uri, config)
  uri = 'drbssl://:0' unless uri
  host, port, = parse_uri(uri)
  if host.size == 0
    host = getservername
    soc = open_server_inaddr_any(host, port)
  else
    soc = TCPServer.open(host, port)
  end
  port = soc.addr[1] if port == 0
  @uri = "drbssl://#{host}:#{port}"

  ssl_conf = SSLConfig.new(config)
  ssl_conf.setup_certificate
  ssl_conf.setup_ssl_context
  self.new(@uri, soc, ssl_conf, false)
end
            
There is an updated format of the API docs for this version here.