lib/polyphony/net.rb
# Wraps the given socket with a SSLSocket and performs a TLS handshake.
#
# @param socket [Socket] plain socket
# @param context [SSLContext, nil] SSL context
# @param opts [Hash] connection options
# @return [SSLSocket] SSL socket
Wraps the given socket with a SSLSocket and performs a TLS handshake.
Wraps the given socket with a SSLSocket and performs a TLS handshake .
def secure_socket(socket, context, opts)
        context ||= OpenSSL::SSL::SSLContext.new
        setup_alpn(context, opts[:alpn_protocols]) if opts[:alpn_protocols]
        socket = secure_socket_wrapper(socket, context)
        socket.tap do |s|
          s.hostname = opts[:host] if opts[:host]
          s.connect
          s.post_connection_check(opts[:host]) if opts[:host]
        end
      end
def secure_socket ( socket , context , opts ) context ||= OpenSSL :: SSL :: SSLContext . new setup_alpn ( context , opts [ :alpn_protocols ] ) if opts [ :alpn_protocols ] socket = secure_socket_wrapper ( socket , context ) socket . tap do | s | s . hostname = opts [ :host ] if opts [ :host ] s . connect s . post_connection_check ( opts [ :host ] ) if opts [ :host ] end end
Wraps the given socket with a SSLSocket and performs a TLS handshake.
Wraps the given socket with a SSLSocket and performs a TLS handshake .
None
SSLSocket
socket
None
context
None
opts
None