# DRb::DRbSSLSocket (Class)

In: | drb/ssl.rb
Parent: | DRbTCPSocket

## Methods

accept close new open open_server parse_uri stream uri_option

## Classes and Modules

Class DRb::DRbSSLSocket::SSLConfig

## Public Class methods

parse_uri(uri)

[Source]

    # File drb/ssl.rb, line 112
        def self.parse_uri(uri)
          if uri =~ /^drbssl:\/\/(.*?):(\d+)(\?(.*))?$/
            host = $1
            port = $2.to_i
            option = $4
            [host, port, option]
          else
            raise(DRbBadScheme, uri) unless uri =~ /^drbssl:/
            raise(DRbBadURI, 'can\'t parse uri:' + uri)
          end
        end

open(uri, config)

[Source]

    # File drb/ssl.rb, line 124
        def self.open(uri, config)
          host, port, option = parse_uri(uri)
          host.untaint
          port.untaint
          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)

[Source]

    # File drb/ssl.rb, line 135
        def self.open_server(uri, config)
          uri = 'drbssl://:0' unless uri
          host, port, opt = parse_uri(uri)
          if host.size == 0
            soc = TCPServer.open(port)
            host = Socket.gethostname
          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

uri_option(uri, config)

[Source]

    # File drb/ssl.rb, line 153
        def self.uri_option(uri, config)
          host, port, option = parse_uri(uri)
          return "drbssl://#{host}:#{port}", option
        end

new(uri, soc, config, is_established)

[Source]

    # File drb/ssl.rb, line 158
        def initialize(uri, soc, config, is_established)
          @ssl = is_established ? soc : nil
          super(uri, soc.to_io, config)
        end

## Public Instance methods

stream()

[Source]

    # File drb/ssl.rb, line 163
        def stream; @ssl; end

close()

[Source]

    # File drb/ssl.rb, line 165
        def close
          if @ssl
            @ssl.close
            @ssl = nil
          end
          super
        end

accept()

[Source]

    # File drb/ssl.rb, line 173
        def accept
          while true
            soc = @socket.accept
            break if (@acl ? @acl.allow_socket?(soc) : true)
            soc.close
          end
          ssl = @config.accept(soc)
          self.class.new(uri, ssl, @config, true)
        end

[Validate]