httpclient 2.8.2 → 2.8.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ec7e272df4e6600193bdd3a5fb96d7079884e9b1
4
- data.tar.gz: 7582ada524a7bf3f92745af4f944187f302f22f9
3
+ metadata.gz: 2b5686de1cd51430fc814921d00eef9589abb460
4
+ data.tar.gz: f4882d0555214f10727a0f0f43e76952167a5bc0
5
5
  SHA512:
6
- metadata.gz: 42e6d5bdb00c17c46eedb6d73277d6e2197ac61a010c50efbb48cee2c5a502127c65863cee60b5450a17a063434cbde70de926d435cd978c2b5c542acec17fe7
7
- data.tar.gz: 6e2cc8eda6e3ad3d53d2c7a2ccb554a1a82de12b88404d9d61e51e9a1f1f2057868100e98302cbfd589c732a96b13c33a03563064ba3dff7b4ba4b76114d73dd
6
+ metadata.gz: 47c2d49d8395a7c2c3d5994f3d91315d787a6b18d7b6cb7b7f0b85144c41930092d7518a3be7df990db2918e6dc661d0422a7d0c699f413c58bd62dd9b8c3119
7
+ data.tar.gz: e37781d77163754c473a2b0e73990c079788b3117ce11fed68d7761060f765bb51ddeca0c3acea4d45ddc9cf9ba5c37c5c443e589d3ccfefb36359c07a4c57b2
@@ -21,7 +21,7 @@ require 'zlib'
21
21
  require 'httpclient/timeout' # TODO: remove this once we drop 1.8 support
22
22
  require 'httpclient/ssl_config'
23
23
  require 'httpclient/http'
24
- if defined?(JRuby)
24
+ if RUBY_ENGINE == 'jruby'
25
25
  require 'httpclient/jruby_ssl_socket'
26
26
  else
27
27
  require 'httpclient/ssl_socket'
@@ -39,21 +39,27 @@ class HTTPClient
39
39
  if SSLEnabled
40
40
  include OpenSSL
41
41
 
42
- module ::OpenSSL
43
- module X509
44
- class Store
45
- attr_reader :_httpclient_cert_store_items
46
-
47
- def initialize(*a, &b)
48
- super(*a, &b)
49
- @_httpclient_cert_store_items = [ENV['SSL_CERT_FILE'] || :default]
50
- end
42
+ if RUBY_ENGINE == 'jruby'
43
+ module ::OpenSSL
44
+ module X509
45
+ class Store
46
+ attr_reader :_httpclient_cert_store_items
47
+
48
+ # TODO: use prepend instead when we drop JRuby + 1.9.x support
49
+ wrapped = {}
50
+
51
+ wrapped[:initialize] = instance_method(:initialize)
52
+ define_method(:initialize) do |*args|
53
+ wrapped[:initialize].bind(self).call(*args)
54
+ @_httpclient_cert_store_items = [ENV['SSL_CERT_FILE'] || :default]
55
+ end
51
56
 
52
- [:add_cert, :add_file, :add_path].each do |m|
53
- wrapped = instance_method(m)
54
- define_method(m) do |cert|
55
- wrapped.bind(self).call(cert)
56
- @_httpclient_cert_store_items << cert
57
+ [:add_cert, :add_file, :add_path].each do |m|
58
+ wrapped[m] = instance_method(m)
59
+ define_method(m) do |cert|
60
+ wrapped[m].bind(self).call(cert)
61
+ @_httpclient_cert_store_items << cert
62
+ end
57
63
  end
58
64
  end
59
65
  end
@@ -112,7 +118,7 @@ class HTTPClient
112
118
  attr_reader :client_ca # :nodoc:
113
119
 
114
120
  # These array keeps original files/dirs that was added to @cert_store
115
- def cert_store_items; @cert_store._httpclient_cert_store_items; end
121
+ def cert_store_items; @cert_store._httpclient_cert_store_items || []; end
116
122
  attr_reader :cert_store_crl_items
117
123
 
118
124
  # Creates a SSLConfig.
@@ -1,3 +1,3 @@
1
1
  class HTTPClient
2
- VERSION = '2.8.2'
2
+ VERSION = '2.8.2.1'
3
3
  end
@@ -80,6 +80,16 @@ end
80
80
  assert(str.scan(/^hello$/)[0])
81
81
  end
82
82
 
83
+ def test_verification_without_httpclient
84
+ raw_cert = "-----BEGIN CERTIFICATE-----\nMIIDOTCCAiGgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBCMRMwEQYKCZImiZPyLGQB\nGRYDb3JnMRkwFwYKCZImiZPyLGQBGRYJcnVieS1sYW5nMRAwDgYDVQQDDAdSdWJ5\nIENBMB4XDTE2MDgxMDE3MjEzNFoXDTE3MDgxMDE3MjEzNFowSzETMBEGCgmSJomT\n8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BVuvPesMVHTh3Whm5kmCdWcBJU0QmSq42ZL\n72U0PXLR\n-----END CERTIFICATE-----"
86
+ ca_cert = ::OpenSSL::X509::Certificate.new(raw_ca_cert)
87
+ cert = ::OpenSSL::X509::Certificate.new(raw_cert)
88
+ store = ::OpenSSL::X509::Store.new
89
+ store.add_cert(ca_cert)
90
+ assert(store.verify(cert))
91
+ end
92
+
83
93
  def test_verification
84
94
  cfg = @client.ssl_config
85
95
  cfg.verify_callback = method(:verify_callback).to_proc
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: httpclient
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.2
4
+ version: 2.8.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hiroshi Nakamura
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-15 00:00:00.000000000 Z
11
+ date: 2016-08-16 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: nahi@ruby-lang.org