httpclient 2.9.0 → 2.11.0

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.
@@ -0,0 +1,51 @@
1
+ require 'test/unit'
2
+ require 'httpclient'
3
+
4
+ class TestSSLConfig < Test::Unit::TestCase
5
+ # Older ruby-openssl returns generic PKey objects without DER export methods.
6
+ CertificateWithoutKeyExport = Struct.new(:to_der) do
7
+ def public_key
8
+ Object.new
9
+ end
10
+ end
11
+
12
+ data('X.509 v1' => false, 'X.509 v3' => true)
13
+ def test_public_key_without_der_export(explicit_version)
14
+ certificate = OpenSSL::X509::Certificate.new(File.read(File.join(__dir__, 'ca.cert')))
15
+ public_key_der = certificate.public_key.to_der
16
+ encoded = OpenSSL::ASN1.decode(certificate.to_der)
17
+ unless explicit_version
18
+ # Only the DER layout matters here; the checker does not verify signatures.
19
+ fields = encoded.value[0].value
20
+ fields.shift
21
+ fields.reject! { |field| field.tag_class == :CONTEXT_SPECIFIC && field.tag == 3 }
22
+ end
23
+ peer = CertificateWithoutKeyExport.new(encoded.to_der)
24
+ config = HTTPClient::SSLConfig.new(nil)
25
+ assert_nothing_raised { config.check_peer_certificates([peer]) }
26
+
27
+ original = HTTPClient::SSLConfig::BLOCKED_SPKI_SHA256
28
+ HTTPClient::SSLConfig.send(:remove_const, :BLOCKED_SPKI_SHA256)
29
+ HTTPClient::SSLConfig.const_set(:BLOCKED_SPKI_SHA256,
30
+ original + [OpenSSL::Digest::SHA256.hexdigest(public_key_der)])
31
+ assert_raise(OpenSSL::SSL::SSLError) { config.check_peer_certificates([peer]) }
32
+ ensure
33
+ if original
34
+ HTTPClient::SSLConfig.send(:remove_const, :BLOCKED_SPKI_SHA256)
35
+ HTTPClient::SSLConfig.const_set(:BLOCKED_SPKI_SHA256, original)
36
+ end
37
+ end
38
+
39
+ def test_blocked_cross_signed_keys_without_der_export
40
+ pem = File.read(File.join(__dir__, 'fixtures/emudhra-dv-g3b.pem'))
41
+ certificates = pem.scan(/-----BEGIN CERTIFICATE-----.*?-----END CERTIFICATE-----/m)
42
+ assert_equal(2, certificates.size)
43
+ certificates.each do |encoded|
44
+ certificate = OpenSSL::X509::Certificate.new(encoded)
45
+ peer = CertificateWithoutKeyExport.new(certificate.to_der)
46
+ assert_raise(OpenSSL::SSL::SSLError) do
47
+ HTTPClient::SSLConfig.new(nil).check_peer_certificates([peer])
48
+ end
49
+ end
50
+ end
51
+ end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: httpclient
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.9.0
4
+ version: 2.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hiroshi Nakamura
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2025-02-22 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: mutex_m
@@ -24,7 +23,6 @@ dependencies:
24
23
  - - ">="
25
24
  - !ruby/object:Gem::Version
26
25
  version: '0'
27
- description:
28
26
  email: nahi@ruby-lang.org
29
27
  executables:
30
28
  - httpclient
@@ -83,6 +81,7 @@ files:
83
81
  - test/client-pass.key
84
82
  - test/client.cert
85
83
  - test/client.key
84
+ - test/fixtures/emudhra-dv-g3b.pem
86
85
  - test/fixtures/verify.alt.cert
87
86
  - test/fixtures/verify.foo.cert
88
87
  - test/fixtures/verify.key
@@ -90,7 +89,9 @@ files:
90
89
  - test/helper.rb
91
90
  - test/htdigest
92
91
  - test/htpasswd
92
+ - test/jruby_ssl_socket/test_mutable_buffers.rb
93
93
  - test/jruby_ssl_socket/test_pemutils.rb
94
+ - test/jruby_ssl_socket/test_socket_timeout.rb
94
95
  - test/runner.rb
95
96
  - test/server.cert
96
97
  - test/server.key
@@ -99,19 +100,22 @@ files:
99
100
  - test/subca.key
100
101
  - test/subca.srl
101
102
  - test/test_auth.rb
103
+ - test/test_auth_fixture.rb
102
104
  - test/test_cookie.rb
105
+ - test/test_helper_lifecycle.rb
103
106
  - test/test_hexdump.rb
104
107
  - test/test_http-access2.rb
105
108
  - test/test_httpclient.rb
106
109
  - test/test_include_client.rb
107
110
  - test/test_jsonclient.rb
111
+ - test/test_proxy_auth_scope.rb
108
112
  - test/test_ssl.rb
113
+ - test/test_ssl_config.rb
109
114
  - test/test_webagent-cookie.rb
110
115
  homepage: https://github.com/nahi/httpclient
111
116
  licenses:
112
117
  - ruby
113
118
  metadata: {}
114
- post_install_message:
115
119
  rdoc_options: []
116
120
  require_paths:
117
121
  - lib
@@ -126,8 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
130
  - !ruby/object:Gem::Version
127
131
  version: '0'
128
132
  requirements: []
129
- rubygems_version: 3.5.3
130
- signing_key:
133
+ rubygems_version: 4.0.20
131
134
  specification_version: 4
132
135
  summary: gives something like the functionality of libwww-perl (LWP) in Ruby
133
136
  test_files: []