Method: HTTPClient::SSLConfig#set_context
- Defined in:
- lib/httpclient/ssl_config.rb
#set_context(ctx) ⇒ Object
interfaces for SSLSocket.
290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 |
# File 'lib/httpclient/ssl_config.rb', line 290 def set_context(ctx) # :nodoc: load_trust_ca unless @cacerts_loaded @cacerts_loaded = true # Verification: Use Store#verify_callback instead of SSLContext#verify*? ctx.cert_store = @cert_store ctx.verify_mode = @verify_mode ctx.verify_depth = @verify_depth if @verify_depth ctx.verify_callback = @verify_callback || method(:default_verify_callback) # SSL config if @client_cert ctx.cert = @client_cert.is_a?(X509::Certificate) ? @client_cert : X509::Certificate.new(File.open(@client_cert) { |f| f.read }) end if @client_key ctx.key = @client_key.is_a?(PKey::PKey) ? @client_key : PKey::RSA.new(File.open(@client_key) { |f| f.read }, @client_key_pass) end ctx.client_ca = @client_ca ctx.timeout = @timeout ctx. = ctx.ciphers = @ciphers ctx.ssl_version = @ssl_version unless @ssl_version == :auto end |