httpx 0.24.4 → 0.24.5

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
  SHA256:
3
- metadata.gz: bea174e31d4b4ca6122f591794da1096f14cf1ff058709c15a85adc3a871a011
4
- data.tar.gz: 867912bad9a8161ee411a543de7932120f7eec975810c5150a308d004f7afaeb
3
+ metadata.gz: b3d9a59fa9d9cc1908f3135c38d9a8cb132312c0539795d3a341d87da3755d23
4
+ data.tar.gz: 8e88ca75fceac380b8fbb31fa627f3a30a2b938e2527baffbc2db00db64b76e5
5
5
  SHA512:
6
- metadata.gz: 414ee34d56f3754b9109dfb7c20d2bfb9485fc070686993ad5271fcbfd4e5b01e3b7a56fa4ca18ad27435d4cc82ba8ec191975de4f42b44f8c03222775614996
7
- data.tar.gz: 898850bfe5bf66b8d6b050eb1669cd4057417cdd9c320c0aaf962ab6a1c73958554452d67ed7a34e8f2d40b94910888aa70cd03589406bf0fab571e752c64ec7
6
+ metadata.gz: fe80712332209f6b188eca10aea16f0d1cb02b8af18682e6efda3844cd5d5de9e99cb0829cf162433fe85f7a070865808caa32a69df3ebe84b7dd483c105315f
7
+ data.tar.gz: 1ec1dd55a8ec80bceaab32a39dfa2e325f01f83c5e512be5c74feb8f4049ef9f34431ab6d33d00ad4b6fcf906d7883a0420e91a0663f2eb4fdd6ddb632b4d351
@@ -0,0 +1,6 @@
1
+ # 0.24.5
2
+
3
+ ## Bugfixes
4
+
5
+ * fix for SSL handshake post connection SAN check using IPv6 address.
6
+ * fix bug in DoH impl when the request returned no answer.
data/lib/httpx/io/ssl.rb CHANGED
@@ -4,7 +4,6 @@ require "openssl"
4
4
 
5
5
  module HTTPX
6
6
  TLSError = OpenSSL::SSL::SSLError
7
- IPRegex = Regexp.union(Resolv::IPv4::Regex, Resolv::IPv6::Regex)
8
7
 
9
8
  class SSL < TCP
10
9
  using RegexpExtensions unless Regexp.method_defined?(:match?)
@@ -41,7 +40,6 @@ module HTTPX
41
40
  yield(self) if block_given?
42
41
  end
43
42
 
44
- @hostname_is_ip = IPRegex.match?(@sni_hostname)
45
43
  @verify_hostname = @ctx.verify_hostname
46
44
  end
47
45
 
@@ -89,14 +87,16 @@ module HTTPX
89
87
  @state != :connected
90
88
 
91
89
  unless @io.is_a?(OpenSSL::SSL::SSLSocket)
92
- if @hostname_is_ip
90
+ if (hostname_is_ip = (@ip == @sni_hostname))
91
+ # IPv6 address would be "[::1]", must turn to "0000:0000:0000:0000:0000:0000:0000:0001" for cert SAN check
92
+ @sni_hostname = @ip.to_string
93
93
  # IP addresses in SNI is not valid per RFC 6066, section 3.
94
94
  @ctx.verify_hostname = false
95
95
  end
96
96
 
97
97
  @io = OpenSSL::SSL::SSLSocket.new(@io, @ctx)
98
98
 
99
- @io.hostname = @sni_hostname unless @hostname_is_ip
99
+ @io.hostname = @sni_hostname unless hostname_is_ip
100
100
  @io.session = @ssl_session unless ssl_session_expired?
101
101
  @io.sync_close = true
102
102
  end
@@ -132,7 +132,7 @@ module HTTPX
132
132
 
133
133
  case code
134
134
  when :ok
135
- parse_addresses(result)
135
+ parse_addresses(result, request)
136
136
  when :no_domain_found
137
137
  # Indicates no such domain was found.
138
138
 
@@ -146,13 +146,13 @@ module HTTPX
146
146
 
147
147
  emit_resolve_error(connection)
148
148
  when :decode_error
149
- host, connection = @queries.first
150
- reset_hostname(host)
149
+ host = @requests.delete(request)
150
+ connection = reset_hostname(host)
151
151
  emit_resolve_error(connection, connection.origin.host, result)
152
152
  end
153
153
  end
154
154
 
155
- def parse_addresses(answers)
155
+ def parse_addresses(answers, request)
156
156
  if answers.empty?
157
157
  # no address found, eliminate candidates
158
158
  host = @requests.delete(request)
data/lib/httpx/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HTTPX
4
- VERSION = "0.24.4"
4
+ VERSION = "0.24.5"
5
5
  end
data/sig/io/ssl.rbs CHANGED
@@ -1,8 +1,4 @@
1
1
  module HTTPX
2
- IPRegex: Regexp
3
-
4
- @ctx: OpenSSL::SSL::SSLContext
5
- @verify_hostname: bool
6
2
 
7
3
  class TLSError < OpenSSL::SSL::SSLError
8
4
  end
@@ -10,6 +6,11 @@ module HTTPX
10
6
  class SSL < TCP
11
7
  TLS_OPTIONS: Hash[Symbol, untyped]
12
8
 
9
+ @ctx: OpenSSL::SSL::SSLContext
10
+ @verify_hostname: bool
11
+
12
+ attr_writer ssl_session: OpenSSL::SSL::Session?
13
+
13
14
  # TODO: lift when https://github.com/ruby/rbs/issues/1497 fixed
14
15
  # def initialize: (URI::Generic origin, Array[ipaddr]? addresses, options options) ?{ (self) -> void } -> void
15
16
 
@@ -32,6 +32,8 @@ module HTTPX
32
32
 
33
33
  def parse: (Request request, Response response) -> void
34
34
 
35
+ def parse_addresses: (Array[dns_result] answers, Request request) -> void
36
+
35
37
  def build_request: (String hostname) -> Request
36
38
 
37
39
  def decode_response_body: (Response) -> dns_decoding_response
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: httpx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.24.4
4
+ version: 0.24.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tiago Cardoso
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-06 00:00:00.000000000 Z
11
+ date: 2023-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http-2-next
@@ -104,6 +104,7 @@ extra_rdoc_files:
104
104
  - doc/release_notes/0_24_2.md
105
105
  - doc/release_notes/0_24_3.md
106
106
  - doc/release_notes/0_24_4.md
107
+ - doc/release_notes/0_24_5.md
107
108
  - doc/release_notes/0_2_0.md
108
109
  - doc/release_notes/0_2_1.md
109
110
  - doc/release_notes/0_3_0.md
@@ -200,6 +201,7 @@ files:
200
201
  - doc/release_notes/0_24_2.md
201
202
  - doc/release_notes/0_24_3.md
202
203
  - doc/release_notes/0_24_4.md
204
+ - doc/release_notes/0_24_5.md
203
205
  - doc/release_notes/0_2_0.md
204
206
  - doc/release_notes/0_2_1.md
205
207
  - doc/release_notes/0_3_0.md