httpclient 2.8.2.1 → 2.8.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/httpclient/ssl_config.rb +19 -21
- data/lib/httpclient/version.rb +1 -1
- data/test/test_ssl.rb +7 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 021f9c066d91d9a0bd923a76e8129bd11cefcda1
|
4
|
+
data.tar.gz: 937c6478b2fad5ad419cf2a840475490f094edbf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9fcc4b920feb54cbe8a1b0e6108f155cb219fbf7416fb0063168c65db9ec3c2210003c37f24399395ca81ea6627a410596d280174631fc7c53b7b1fc1563964b
|
7
|
+
data.tar.gz: f8d5ecf16b6aea4f12c1d7ed9e8cefb5ef797610996a73b1923d9142cc85d6580f599e539c77fa1aca194a1d6f2622f547a6a3ee6145a0c7f0fb047c6d9b42f9
|
@@ -39,27 +39,25 @@ class HTTPClient
|
|
39
39
|
if SSLEnabled
|
40
40
|
include OpenSSL
|
41
41
|
|
42
|
-
|
43
|
-
module
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
end
|
42
|
+
module ::OpenSSL
|
43
|
+
module X509
|
44
|
+
class Store
|
45
|
+
attr_reader :_httpclient_cert_store_items
|
46
|
+
|
47
|
+
# TODO: use prepend instead when we drop JRuby + 1.9.x support
|
48
|
+
wrapped = {}
|
49
|
+
|
50
|
+
wrapped[:initialize] = instance_method(:initialize)
|
51
|
+
define_method(:initialize) do |*args|
|
52
|
+
wrapped[:initialize].bind(self).call(*args)
|
53
|
+
@_httpclient_cert_store_items = [ENV['SSL_CERT_FILE'] || :default]
|
54
|
+
end
|
56
55
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
end
|
56
|
+
[:add_cert, :add_file, :add_path].each do |m|
|
57
|
+
wrapped[m] = instance_method(m)
|
58
|
+
define_method(m) do |cert|
|
59
|
+
wrapped[m].bind(self).call(cert)
|
60
|
+
@_httpclient_cert_store_items << cert
|
63
61
|
end
|
64
62
|
end
|
65
63
|
end
|
@@ -118,7 +116,7 @@ class HTTPClient
|
|
118
116
|
attr_reader :client_ca # :nodoc:
|
119
117
|
|
120
118
|
# These array keeps original files/dirs that was added to @cert_store
|
121
|
-
def cert_store_items; @cert_store._httpclient_cert_store_items
|
119
|
+
def cert_store_items; @cert_store._httpclient_cert_store_items; end
|
122
120
|
attr_reader :cert_store_crl_items
|
123
121
|
|
124
122
|
# Creates a SSLConfig.
|
data/lib/httpclient/version.rb
CHANGED
data/test/test_ssl.rb
CHANGED
@@ -175,6 +175,13 @@ end
|
|
175
175
|
#
|
176
176
|
cfg.cert_store.add_cert(cert('subca.cert'))
|
177
177
|
assert_equal("hello", @client.get_content(@url))
|
178
|
+
cfg.clear_cert_store
|
179
|
+
begin
|
180
|
+
@client.get(@url)
|
181
|
+
assert(false)
|
182
|
+
rescue OpenSSL::SSL::SSLError => ssle
|
183
|
+
assert_match(/(certificate verify failed|unable to find valid certification path to requested target)/, ssle.message)
|
184
|
+
end
|
178
185
|
end
|
179
186
|
|
180
187
|
if defined?(HTTPClient::JRubySSLSocket)
|