httpx 0.24.4 → 0.24.6

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: 80234bd7d5ea31711a4cdc1c90733cc929bc84d591da8a7fbfad6be66c8a6bf5
4
+ data.tar.gz: 411496737c758f76b0a9b09f1f67eae7cd548699ce6efdf7865f6b1a51dec79a
5
5
  SHA512:
6
- metadata.gz: 414ee34d56f3754b9109dfb7c20d2bfb9485fc070686993ad5271fcbfd4e5b01e3b7a56fa4ca18ad27435d4cc82ba8ec191975de4f42b44f8c03222775614996
7
- data.tar.gz: 898850bfe5bf66b8d6b050eb1669cd4057417cdd9c320c0aaf962ab6a1c73958554452d67ed7a34e8f2d40b94910888aa70cd03589406bf0fab571e752c64ec7
6
+ metadata.gz: e06a3995e597f253e29d78826930c6db6ec3a878e5e0bae96ec6c93e8e49c60f35ec1231218ef84d20350d73d4058bbe204e60111a66983a0e0b104bf61e6059
7
+ data.tar.gz: 175e3a5d83932d4e3a431cf4e2a65d8aa550a3028585c1b3c65970ba736529128f93eba5dd02125753d6c6460769c827aa80ecb6e6f49f2af10c1797c97a03e2
@@ -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.
@@ -0,0 +1,5 @@
1
+ # 0.24.6
2
+
3
+ ## Bugfixes
4
+
5
+ * fix Session class assertions not prepared for class overrides, which could break some plugins which override the Session class on load (such as `datadog` or `webmock` adapters).
@@ -48,7 +48,7 @@ module HTTPX
48
48
  end
49
49
 
50
50
  def plugin(pl, options = nil, &blk)
51
- klass = is_a?(Session) ? self.class : Session
51
+ klass = is_a?(S) ? self.class : Session
52
52
  klass = Class.new(klass)
53
53
  klass.instance_variable_set(:@default_options, klass.default_options.merge(default_options))
54
54
  klass.plugin(pl, options, &blk).new
@@ -58,7 +58,7 @@ module HTTPX
58
58
  # :nocov:
59
59
  def plugins(pls)
60
60
  warn ":#{__method__} is deprecated, use :plugin instead"
61
- klass = is_a?(Session) ? self.class : Session
61
+ klass = is_a?(S) ? self.class : Session
62
62
  klass = Class.new(klass)
63
63
  klass.instance_variable_set(:@default_options, klass.default_options.merge(default_options))
64
64
  klass.plugins(pls).new
@@ -82,7 +82,7 @@ module HTTPX
82
82
  end
83
83
 
84
84
  def branch(options, &blk)
85
- return self.class.new(options, &blk) if is_a?(Session)
85
+ return self.class.new(options, &blk) if is_a?(S)
86
86
 
87
87
  Session.new(options, &blk)
88
88
  end
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/session.rb CHANGED
@@ -351,4 +351,7 @@ module HTTPX
351
351
  # :nocov:
352
352
  end
353
353
  end
354
+
355
+ # session may be overridden by certain adapters.
356
+ S = Session
354
357
  end
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.6"
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
data/sig/session.rbs CHANGED
@@ -51,4 +51,6 @@ module HTTPX
51
51
 
52
52
  attr_reader self.default_options: Options
53
53
  end
54
+
55
+ OriginalSession: singleton(Session)
54
56
  end
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.6
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-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http-2-next
@@ -104,6 +104,8 @@ 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
108
+ - doc/release_notes/0_24_6.md
107
109
  - doc/release_notes/0_2_0.md
108
110
  - doc/release_notes/0_2_1.md
109
111
  - doc/release_notes/0_3_0.md
@@ -200,6 +202,8 @@ files:
200
202
  - doc/release_notes/0_24_2.md
201
203
  - doc/release_notes/0_24_3.md
202
204
  - doc/release_notes/0_24_4.md
205
+ - doc/release_notes/0_24_5.md
206
+ - doc/release_notes/0_24_6.md
203
207
  - doc/release_notes/0_2_0.md
204
208
  - doc/release_notes/0_2_1.md
205
209
  - doc/release_notes/0_3_0.md