httpx 1.1.0 → 1.1.1
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/doc/release_notes/1_1_1.md +17 -0
- data/lib/httpx/connection/http1.rb +3 -3
- data/lib/httpx/connection.rb +2 -3
- data/lib/httpx/plugins/proxy/http.rb +0 -1
- data/lib/httpx/pool.rb +0 -3
- data/lib/httpx/resolver/resolver.rb +5 -2
- data/lib/httpx/resolver/system.rb +4 -1
- data/lib/httpx/resolver.rb +6 -4
- data/lib/httpx/session.rb +3 -1
- data/lib/httpx/timers.rb +2 -0
- data/lib/httpx/version.rb +1 -1
- data/sig/connection/http1.rbs +2 -2
- data/sig/resolver.rbs +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39a2d410f391dedb077e3704edeafde92786201ebd7b1d3e4e2f6aa7e254797b
|
4
|
+
data.tar.gz: bdcc46a37c8cc4ba8edd11355c5dc439a7401569c8ef014c7ca45ac22e97d284
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df50d7db27a18a2f7d610e12b618fc1a8ab2d18a6a1f3bbd70054a4fdab9bec8a8e428115696d5f042f28c7409e7539eaca0f3798d13bc6ab98d88e43d41808d
|
7
|
+
data.tar.gz: 63563a10039713d75e6d3d795ddfc08f91a46c2f73225b9987e96acbed9e23d0c5e69154589afbf0163ec69ff99eb9c34f517fb9d360ad7f951a06fb5569ce95
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# 1.1.1
|
2
|
+
|
3
|
+
## improvements
|
4
|
+
|
5
|
+
* (Re-)enabling default retries in DNS name queries; this had been disabled as a result of revamping timouts, and resulted in queries only being sent once, which is very little for UDP-related traffic, and breaks if using DNs rate-limiting software. Retries the query just once, for now.
|
6
|
+
|
7
|
+
## bugfixes
|
8
|
+
|
9
|
+
* reset timers when adding new intervals, as these may be added as a result on after-select connection handling, and must wait for the next tick cycle (before the patch, they were triggering too soon).
|
10
|
+
* fixed "on close" callback leak on connection reuse, which caused linear performance regression in benchmarks performing one request per connection.
|
11
|
+
* fixed hanging connection whan an HTTP/1.1 emitted a "connection: close" header but the server would not emit one (it closes the connection now).
|
12
|
+
* fixed recursive dns cached lookups which may have already expired, and created nil entries in the returned address list.
|
13
|
+
* dns system resolver is now able to retry on failure.
|
14
|
+
|
15
|
+
## chore
|
16
|
+
|
17
|
+
* remove duplicated callback unregitering connections.
|
@@ -181,7 +181,7 @@ module HTTPX
|
|
181
181
|
if response.is_a?(ErrorResponse)
|
182
182
|
disable
|
183
183
|
else
|
184
|
-
manage_connection(response)
|
184
|
+
manage_connection(request, response)
|
185
185
|
end
|
186
186
|
|
187
187
|
if exhausted?
|
@@ -224,7 +224,7 @@ module HTTPX
|
|
224
224
|
|
225
225
|
private
|
226
226
|
|
227
|
-
def manage_connection(response)
|
227
|
+
def manage_connection(request, response)
|
228
228
|
connection = response.headers["connection"]
|
229
229
|
case connection
|
230
230
|
when /keep-alive/i
|
@@ -254,7 +254,7 @@ module HTTPX
|
|
254
254
|
disable
|
255
255
|
when nil
|
256
256
|
# In HTTP/1.1, it's keep alive by default
|
257
|
-
return if response.version == "1.1"
|
257
|
+
return if response.version == "1.1" && request.headers["connection"] != "close"
|
258
258
|
|
259
259
|
disable
|
260
260
|
end
|
data/lib/httpx/connection.rb
CHANGED
@@ -273,7 +273,7 @@ module HTTPX
|
|
273
273
|
end
|
274
274
|
|
275
275
|
def timeout
|
276
|
-
return @timeout if
|
276
|
+
return @timeout if @timeout
|
277
277
|
|
278
278
|
return @options.timeout[:connect_timeout] if @state == :idle
|
279
279
|
|
@@ -518,7 +518,6 @@ module HTTPX
|
|
518
518
|
else
|
519
519
|
transition(:closing)
|
520
520
|
transition(:closed)
|
521
|
-
emit(:reset)
|
522
521
|
|
523
522
|
@parser.reset if @parser
|
524
523
|
transition(:idle)
|
@@ -617,7 +616,7 @@ module HTTPX
|
|
617
616
|
def purge_after_closed
|
618
617
|
@io.close if @io
|
619
618
|
@read_buffer.clear
|
620
|
-
|
619
|
+
@timeout = nil
|
621
620
|
end
|
622
621
|
|
623
622
|
def build_socket(addrs = nil)
|
data/lib/httpx/pool.rb
CHANGED
@@ -62,8 +62,11 @@ module HTTPX
|
|
62
62
|
addresses.first.to_s != connection.origin.host.to_s
|
63
63
|
log { "resolver: A response, applying resolution delay..." }
|
64
64
|
@pool.after(0.05) do
|
65
|
-
|
66
|
-
|
65
|
+
unless connection.state == :closed ||
|
66
|
+
# double emission check
|
67
|
+
(connection.addresses && addresses.intersect?(connection.addresses))
|
68
|
+
emit_resolved_connection(connection, addresses)
|
69
|
+
end
|
67
70
|
end
|
68
71
|
else
|
69
72
|
emit_resolved_connection(connection, addresses)
|
@@ -164,7 +164,8 @@ module HTTPX
|
|
164
164
|
def async_resolve(connection, hostname, scheme)
|
165
165
|
families = connection.options.ip_families
|
166
166
|
log { "resolver: query for #{hostname}" }
|
167
|
-
|
167
|
+
timeouts = @timeouts[connection.origin.host]
|
168
|
+
resolve_timeout = timeouts.first
|
168
169
|
|
169
170
|
Thread.start do
|
170
171
|
Thread.current.report_on_exception = false
|
@@ -191,6 +192,8 @@ module HTTPX
|
|
191
192
|
end
|
192
193
|
rescue StandardError => e
|
193
194
|
if e.is_a?(Timeout::Error)
|
195
|
+
timeouts.shift
|
196
|
+
retry unless timeouts.empty?
|
194
197
|
e = ResolveTimeoutError.new(resolve_timeout, e.message)
|
195
198
|
e.set_backtrace(e.backtrace)
|
196
199
|
end
|
data/lib/httpx/resolver.rb
CHANGED
@@ -5,7 +5,7 @@ require "ipaddr"
|
|
5
5
|
|
6
6
|
module HTTPX
|
7
7
|
module Resolver
|
8
|
-
RESOLVE_TIMEOUT =
|
8
|
+
RESOLVE_TIMEOUT = [2, 3].freeze
|
9
9
|
|
10
10
|
require "httpx/resolver/resolver"
|
11
11
|
require "httpx/resolver/system"
|
@@ -87,16 +87,18 @@ module HTTPX
|
|
87
87
|
def lookup(hostname, ttl)
|
88
88
|
return unless @lookups.key?(hostname)
|
89
89
|
|
90
|
-
@lookups[hostname] = @lookups[hostname].select do |address|
|
90
|
+
entries = @lookups[hostname] = @lookups[hostname].select do |address|
|
91
91
|
address["TTL"] > ttl
|
92
92
|
end
|
93
|
-
|
93
|
+
|
94
|
+
ips = entries.flat_map do |address|
|
94
95
|
if address.key?("alias")
|
95
96
|
lookup(address["alias"], ttl)
|
96
97
|
else
|
97
98
|
IPAddr.new(address["data"])
|
98
99
|
end
|
99
|
-
end
|
100
|
+
end.compact
|
101
|
+
|
100
102
|
ips unless ips.empty?
|
101
103
|
end
|
102
104
|
|
data/lib/httpx/session.rb
CHANGED
@@ -260,7 +260,9 @@ module HTTPX
|
|
260
260
|
connection.on(:open) do
|
261
261
|
emit(:connection_opened, connection.origin, connection.io.socket)
|
262
262
|
# only run close callback if it opened
|
263
|
-
|
263
|
+
end
|
264
|
+
connection.on(:close) do
|
265
|
+
emit(:connection_closed, connection.origin, connection.io.socket) if connection.used?
|
264
266
|
end
|
265
267
|
catch(:coalesced) do
|
266
268
|
pool.init_connection(connection, options)
|
data/lib/httpx/timers.rb
CHANGED
data/lib/httpx/version.rb
CHANGED
data/sig/connection/http1.rbs
CHANGED
@@ -59,13 +59,13 @@ module HTTPX
|
|
59
59
|
|
60
60
|
def initialize: (Buffer, options) -> untyped
|
61
61
|
|
62
|
-
def manage_connection: (Response) -> void
|
62
|
+
def manage_connection: (Request request, Response response) -> void
|
63
63
|
|
64
64
|
def disable: () -> void
|
65
65
|
|
66
66
|
def disable_pipelining: () -> void
|
67
67
|
|
68
|
-
def set_protocol_headers: (Request) -> _Each[[String, String]]
|
68
|
+
def set_protocol_headers: (Request request) -> _Each[[String, String]]
|
69
69
|
|
70
70
|
def handle: (Request request) -> void
|
71
71
|
|
data/sig/resolver.rbs
CHANGED
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: 1.1.
|
4
|
+
version: 1.1.1
|
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-
|
11
|
+
date: 2023-11-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http-2-next
|
@@ -132,6 +132,7 @@ extra_rdoc_files:
|
|
132
132
|
- doc/release_notes/1_0_1.md
|
133
133
|
- doc/release_notes/1_0_2.md
|
134
134
|
- doc/release_notes/1_1_0.md
|
135
|
+
- doc/release_notes/1_1_1.md
|
135
136
|
files:
|
136
137
|
- LICENSE.txt
|
137
138
|
- README.md
|
@@ -235,6 +236,7 @@ files:
|
|
235
236
|
- doc/release_notes/1_0_1.md
|
236
237
|
- doc/release_notes/1_0_2.md
|
237
238
|
- doc/release_notes/1_1_0.md
|
239
|
+
- doc/release_notes/1_1_1.md
|
238
240
|
- lib/httpx.rb
|
239
241
|
- lib/httpx/adapters/datadog.rb
|
240
242
|
- lib/httpx/adapters/faraday.rb
|