Skip to content

Commit

Permalink
followed origin/master changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mumumu committed Feb 4, 2019
1 parent 56679f2 commit 9aeb8e7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 18 deletions.
19 changes: 3 additions & 16 deletions lib/httpclient/ssl_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,6 @@ def initialize(client)
return unless SSLEnabled
@client = client
@cert_store = X509::Store.new
@cert_store.set_default_paths
@cacerts_loaded = working_openssl_platform?

@cert_store_crl_items = []
@client_cert = @client_key = @client_key_pass = @client_ca = nil
@verify_mode = SSL::VERIFY_PEER | SSL::VERIFY_FAIL_IF_NO_PEER_CERT
Expand All @@ -165,6 +162,7 @@ def initialize(client)
@options |= OpenSSL::SSL::OP_NO_SSLv3 if defined?(OpenSSL::SSL::OP_NO_SSLv3)
# OpenSSL 0.9.8 default: "ALL:!ADH:!LOW:!EXP:!MD5:+SSLv2:@STRENGTH"
@ciphers = CIPHERS_DEFAULT
@cacerts_loaded = false
end

# Sets certificate and private key for SSL client authentication.
Expand Down Expand Up @@ -415,21 +413,10 @@ def change_notify
nil
end

def working_openssl_platform?
File.exist?(OpenSSL::X509::DEFAULT_CERT_FILE) && Dir.exist?(OpenSSL::X509::DEFAULT_CERT_DIR)
end

# Use 2048 bit certs trust anchor
def load_cacerts(cert_store)
certs = if ENV.key?('SSL_CERT_DIR'.freeze) || ENV.key?('SSL_CERT_FILE')
[ ENV['SSL_CERT_DIR'], ENV['SSL_CERT_FILE'] ].compact
else
[ File.join(File.dirname(__FILE__), 'cacert.pem') ]
end

certs.each do |cert|
add_trust_ca_to_store(cert_store, cert)
end
file = File.join(File.dirname(__FILE__), 'cacert.pem')
add_trust_ca_to_store(cert_store, file)
end
end

Expand Down
3 changes: 1 addition & 2 deletions test/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter
SimpleCov.start
rescue LoadError
end if ENV['CI']

end
require 'test/unit'

require 'httpclient'
Expand Down
2 changes: 2 additions & 0 deletions test/test_httpclient.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
require File.expand_path('helper', File.dirname(__FILE__))
require 'tempfile'


class TestHTTPClient < Test::Unit::TestCase
include Helper
include HTTPClient::Util
Expand Down Expand Up @@ -416,6 +417,7 @@ def test_cookie_update_while_authentication
end
end


def test_proxy_ssl
escape_noproxy do
@client.proxy = 'http://admin:admin@localhost:8080/'
Expand Down

0 comments on commit 9aeb8e7

Please sign in to comment.