summaryrefslogtreecommitdiff
path: root/ext/openssl/lib/openssl/ssl.rb
diff options
context:
space:
mode:
authortenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-08-05 22:55:38 +0000
committertenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-08-05 22:55:38 +0000
commitb830786f2d025dac69db636f10ed6107d50ee068 (patch)
treee4f489561438d04e275ccd7e9e59f74f72daa0ba /ext/openssl/lib/openssl/ssl.rb
parent46bd8e86a500e66f5cdf33dce603e2f2794440bb (diff)
* ext/openssl/lib/openssl/ssl.rb (module OpenSSL): move
OpenSSL::SSL::SSLSocket#initialize to Ruby. * ext/openssl/ossl_ssl.c: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/openssl/lib/openssl/ssl.rb')
-rw-r--r--ext/openssl/lib/openssl/ssl.rb45
1 files changed, 45 insertions, 0 deletions
diff --git a/ext/openssl/lib/openssl/ssl.rb b/ext/openssl/lib/openssl/ssl.rb
index cfa2a0c117..8fba3ee369 100644
--- a/ext/openssl/lib/openssl/ssl.rb
+++ b/ext/openssl/lib/openssl/ssl.rb
@@ -94,6 +94,15 @@ module OpenSSL
attr_accessor :tmp_dh_callback
+ if ExtConfig::HAVE_TLSEXT_HOST_NAME
+ # A callback invoked at connect time to distinguish between multiple
+ # server names.
+ #
+ # The callback is invoked with an SSLSocket and a server name. The
+ # callback must return an SSLContext for the server name or nil.
+ attr_accessor :servername_cb
+ end
+
# call-seq:
# SSLContext.new => ctx
# SSLContext.new(:TLSv1) => ctx
@@ -253,6 +262,42 @@ module OpenSSL
include SocketForwarder
include Nonblock
+ if ExtConfig::OPENSSL_NO_SOCK
+ def initialize(io, ctx = nil); raise NotImplmentedError; end
+ else
+ if ExtConfig::HAVE_TLSEXT_HOST_NAME
+ attr_accessor :hostname
+ end
+
+ attr_reader :io, :context
+ attr_accessor :sync_close
+ alias :to_io :io
+
+ # call-seq:
+ # SSLSocket.new(io) => aSSLSocket
+ # SSLSocket.new(io, ctx) => aSSLSocket
+ #
+ # Creates a new SSL socket from +io+ which must be a real ruby object (not an
+ # IO-like object that responds to read/write).
+ #
+ # If +ctx+ is provided the SSL Sockets initial params will be taken from
+ # the context.
+ #
+ # The OpenSSL::Buffering module provides additional IO methods.
+ #
+ # This method will freeze the SSLContext if one is provided;
+ # however, session management is still allowed in the frozen SSLContext.
+
+ def initialize(io, context = OpenSSL::SSL::SSLContext.new)
+ @io = io
+ @context = context
+ @sync_close = false
+ @hostname = nil
+ context.setup
+ super()
+ end
+ end
+
##
# Perform hostname verification after an SSL connection is established
#