diff options
author | tenderlove <tenderlove@ruby-lang.org> | 2015-07-25 18:44:54 +0000 |
---|---|---|
committer | tenderlove <tenderlove@ruby-lang.org> | 2015-07-25 18:44:54 +0000 |
commit | 675eead5966685233e06de540fd956c05252a794 (patch) | |
tree | e6ce99e1ed651fa837e454fc57c18e8707b15bf8 /lib | |
parent | 1ae24a8753f889a210e4a4c71ebcb30482a871bc (diff) | |
download | ruby-openssl-history-675eead5966685233e06de540fd956c05252a794.tar.gz |
* 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 'lib')
-rw-r--r-- | lib/openssl/ssl.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/openssl/ssl.rb b/lib/openssl/ssl.rb index cc956fa..0caa033 100644 --- a/lib/openssl/ssl.rb +++ b/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. |