Class: DRb::DRbAuthenticatedSSLSocket
- Inherits:
-
DRbSSLSocket
- Object
- DRbSSLSocket
- DRb::DRbAuthenticatedSSLSocket
- Defined in:
- lib/drb/authsslprotocol.rb
Overview
A DRb protocol implementation that provides an authenticated, encrypted channel for DRb services.
Constant Summary collapse
- SCHEME =
The scheme of URIs which specify this protocol
'drbauthssl'
Class Method Summary collapse
-
.open(uri, config) ⇒ Object
Open a client connection to the server at
uri
, using configurationconfig
. -
.parse_uri(uri) ⇒ Object
Parse a drbauthssl:// URI.
Class Method Details
.open(uri, config) ⇒ Object
Open a client connection to the server at uri
, using configuration config
. Return a protocol instance for this connection.
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/drb/authsslprotocol.rb', line 36 def self::open( uri, config ) host, port, option = self.parse_uri( uri ) host.untaint port.untaint soc = TCPSocket.open( host, port ) ssl_conf = DRb::DRbSSLSocket::SSLConfig.new( config ) ssl_conf.setup_ssl_context ssl = ssl_conf.connect( soc ) self.new( uri, ssl, ssl_conf, true ) end |
.parse_uri(uri) ⇒ Object
Parse a drbauthssl:// URI. Accepts a String, a URI, or any object that responds to #host, #port, and #query. Return the values from the URI as an Array of the form: [ host, port, optionhash ]. Raises DRbBadScheme if the uri
is not a drbauthssl
URI. Raises DRbBadURI if the uri
is missing the port number.
23 24 25 26 27 28 29 30 31 |
# File 'lib/drb/authsslprotocol.rb', line 23 def self::parse_uri( uri ) uri = URI( uri ) unless uri.respond_to?( :host ) raise DRbBadScheme, "not a #{SCHEME} URI: %p" % [ uri ] unless uri.scheme == SCHEME raise DRbBadURI, "missing the port number" unless uri.port && uri.port.to_i.nonzero? return [ uri.host, uri.port.to_i, uri.query ] end |