summaryrefslogtreecommitdiff
path: root/ext/openssl/lib/openssl/ssl.rb
diff options
context:
space:
mode:
authortenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-25 18:44:54 +0000
committertenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-25 18:44:54 +0000
commitc8884ebfe4e30123de67df90f5d566d6fd0f2ec3 (patch)
treedbe5cc616b10d9368290efc3b482242a71a6639c /ext/openssl/lib/openssl/ssl.rb
parente02186f5263ebecea941cf8554206c6ac5b04ab3 (diff)
* ext/openssl/lib/openssl/ssl.rb (module OpenSSL): move
OpenSSL::SSL::SSLContext#initialize implementation to pure Ruby. * ext/openssl/ossl_ssl.c (ossl_sslctx_initialize): ditto * ext/openssl/ossl_ssl.c (Init_ossl_ssl): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51375 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/openssl/lib/openssl/ssl.rb')
-rw-r--r--ext/openssl/lib/openssl/ssl.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/ext/openssl/lib/openssl/ssl.rb b/ext/openssl/lib/openssl/ssl.rb
index cc956fa6b5..0caa033e5d 100644
--- a/ext/openssl/lib/openssl/ssl.rb
+++ b/ext/openssl/lib/openssl/ssl.rb
@@ -74,6 +74,26 @@ module OpenSSL
DEFAULT_CERT_STORE.flags = OpenSSL::X509::V_FLAG_CRL_CHECK_ALL
end
+ INIT_VARS = ["cert", "key", "client_ca", "ca_file", "ca_path",
+ "timeout", "verify_mode", "verify_depth", "renegotiation_cb",
+ "verify_callback", "options", "cert_store", "extra_chain_cert",
+ "client_cert_cb", "tmp_dh_callback", "session_id_context",
+ "session_get_cb", "session_new_cb", "session_remove_cb",
+ "tmp_ecdh_callback", "servername_cb", "npn_protocols",
+ "npn_select_cb"].map { |x| "@#{x}" }
+
+ # call-seq:
+ # SSLContext.new => ctx
+ # SSLContext.new(:TLSv1) => ctx
+ # SSLContext.new("SSLv23_client") => ctx
+ #
+ # You can get a list of valid methods with OpenSSL::SSL::SSLContext::METHODS
+ def initialize(version = nil)
+ INIT_VARS.each { |v| instance_variable_set v, nil }
+ return unless version
+ self.ssl_version = version
+ end
+
##
# Sets the parameters for this SSL context to the values in +params+.
# The keys in +params+ must be assignment methods on SSLContext.