httpx 0.20.0 → 0.20.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/doc/release_notes/0_19_8.md +1 -1
- data/doc/release_notes/0_20_0.md +1 -1
- data/doc/release_notes/0_20_1.md +5 -0
- data/doc/release_notes/0_20_2.md +7 -0
- data/doc/release_notes/0_20_3.md +6 -0
- data/lib/httpx/connection.rb +6 -0
- data/lib/httpx/io/ssl.rb +6 -6
- data/lib/httpx/pool.rb +4 -4
- data/lib/httpx/resolver/https.rb +1 -0
- data/lib/httpx/resolver/native.rb +7 -3
- data/lib/httpx/response.rb +1 -1
- data/lib/httpx/selector.rb +9 -2
- data/lib/httpx/version.rb +1 -1
- data/sig/connection.rbs +3 -0
- data/sig/pool.rbs +2 -2
- data/sig/resolver/native.rbs +3 -1
- data/sig/selector.rbs +1 -1
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 543163347ad58a18829298d36113f88da710c5b139c14968962cdd88d9d36c86
|
4
|
+
data.tar.gz: 1a460e4e2f079f6b08ede7ad7076039ead2b6fc31cffb590e4c245d38e838dc5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7bf4ccdbefc71b868b51ff130cb0892791935dade7829ffe09b3401dbba112fd354a8781da8d58015afb254206ac8a5187477ac65bdaf09b996909ef2e42f93c
|
7
|
+
data.tar.gz: a06649e2a51aebe113e3604e739916f164a30aa643eb7e2a5f82871929d2ce1c9bb8b9f234c2ac2ce07f3bd995058e8ba7f1b42e5eaf5cb63fe205b753184b0b
|
data/doc/release_notes/0_19_8.md
CHANGED
data/doc/release_notes/0_20_0.md
CHANGED
@@ -0,0 +1,7 @@
|
|
1
|
+
# 0.20.2
|
2
|
+
|
3
|
+
## Bugfixes
|
4
|
+
|
5
|
+
* fix for selector timeout errors closing all connections and ignoring resolvers.
|
6
|
+
|
7
|
+
Timeout errors on select were being propagated to all pooled connections, although not all of them were being selected on, and not all of them having timed out. plus, resolver timeouts were doing the same, making connections fail with connection timeout error, rather than resolve timeout error. A patch was implemented, where the selector now yields an error to the selected connections, rather than plain raising exception.
|
@@ -0,0 +1,6 @@
|
|
1
|
+
# 0.20.3
|
2
|
+
|
3
|
+
## Bugfixes
|
4
|
+
|
5
|
+
* DoH resolver wasn't working for non-absolute (the large majority) of domains since v0.19.
|
6
|
+
* Allowing a single IP string to be passed to the resolver option `:nameserver` (just like the `resolv` library does), besides the already supported list of IPs.
|
data/lib/httpx/connection.rb
CHANGED
@@ -276,6 +276,12 @@ module HTTPX
|
|
276
276
|
@state == :open || @state == :inactive
|
277
277
|
end
|
278
278
|
|
279
|
+
def raise_timeout_error(interval)
|
280
|
+
error = HTTPX::TimeoutError.new(interval, "timed out while waiting on select")
|
281
|
+
error.set_backtrace(caller)
|
282
|
+
on_error(error)
|
283
|
+
end
|
284
|
+
|
279
285
|
private
|
280
286
|
|
281
287
|
def connect
|
data/lib/httpx/io/ssl.rb
CHANGED
@@ -145,12 +145,12 @@ module HTTPX
|
|
145
145
|
"#{super}\n\n" \
|
146
146
|
"SSL connection using #{@io.ssl_version} / #{Array(@io.cipher).first}\n" \
|
147
147
|
"ALPN, server accepted to use #{protocol}\n" \
|
148
|
-
"Server certificate:\n" \
|
149
|
-
"
|
150
|
-
"
|
151
|
-
"
|
152
|
-
"
|
153
|
-
"
|
148
|
+
"Server certificate:\n " \
|
149
|
+
"subject: #{server_cert.subject}\n " \
|
150
|
+
"start date: #{server_cert.not_before}\n " \
|
151
|
+
"expire date: #{server_cert.not_after}\n " \
|
152
|
+
"issuer: #{server_cert.issuer}\n " \
|
153
|
+
"SSL certificate verify ok."
|
154
154
|
end
|
155
155
|
end
|
156
156
|
end
|
data/lib/httpx/pool.rb
CHANGED
@@ -80,6 +80,9 @@ module HTTPX
|
|
80
80
|
connection.on(:activate) do
|
81
81
|
select_connection(connection)
|
82
82
|
end
|
83
|
+
connection.on(:close) do
|
84
|
+
unregister_connection(connection)
|
85
|
+
end
|
83
86
|
end
|
84
87
|
|
85
88
|
def deactivate(connections)
|
@@ -143,8 +146,6 @@ module HTTPX
|
|
143
146
|
|
144
147
|
def on_resolver_error(connection, error)
|
145
148
|
connection.emit(:error, error)
|
146
|
-
# must remove connection by hand, hasn't been started yet
|
147
|
-
unregister_connection(connection)
|
148
149
|
end
|
149
150
|
|
150
151
|
def on_resolver_close(resolver)
|
@@ -171,8 +172,7 @@ module HTTPX
|
|
171
172
|
|
172
173
|
def unregister_connection(connection)
|
173
174
|
@connections.delete(connection)
|
174
|
-
deselect_connection(connection)
|
175
|
-
@connected_connections -= 1
|
175
|
+
@connected_connections -= 1 if deselect_connection(connection)
|
176
176
|
end
|
177
177
|
|
178
178
|
def select_connection(connection)
|
data/lib/httpx/resolver/https.rb
CHANGED
@@ -45,7 +45,7 @@ module HTTPX
|
|
45
45
|
super
|
46
46
|
@ns_index = 0
|
47
47
|
@resolver_options = DEFAULTS.merge(@options.resolver_options)
|
48
|
-
@nameserver = @resolver_options[:nameserver]
|
48
|
+
@nameserver = Array(@resolver_options[:nameserver]) if @resolver_options[:nameserver]
|
49
49
|
@ndots = @resolver_options[:ndots]
|
50
50
|
@search = Array(@resolver_options[:search]).map { |srch| srch.scan(/[^.]+/) }
|
51
51
|
@_timeouts = Array(@resolver_options[:timeouts])
|
@@ -118,6 +118,10 @@ module HTTPX
|
|
118
118
|
@timeouts.values_at(*hosts).reject(&:empty?).map(&:first).min
|
119
119
|
end
|
120
120
|
|
121
|
+
def raise_timeout_error(interval)
|
122
|
+
do_retry(interval)
|
123
|
+
end
|
124
|
+
|
121
125
|
private
|
122
126
|
|
123
127
|
def calculate_interests
|
@@ -134,10 +138,10 @@ module HTTPX
|
|
134
138
|
dwrite if calculate_interests == :w
|
135
139
|
end
|
136
140
|
|
137
|
-
def do_retry
|
141
|
+
def do_retry(loop_time = nil)
|
138
142
|
return if @queries.empty? || !@start_timeout
|
139
143
|
|
140
|
-
loop_time
|
144
|
+
loop_time ||= Utils.elapsed_time(@start_timeout)
|
141
145
|
|
142
146
|
query = @queries.first
|
143
147
|
|
data/lib/httpx/response.rb
CHANGED
data/lib/httpx/selector.rb
CHANGED
@@ -74,7 +74,10 @@ class HTTPX::Selector
|
|
74
74
|
|
75
75
|
readers, writers = IO.select(r, w, nil, interval)
|
76
76
|
|
77
|
-
|
77
|
+
if readers.nil? && writers.nil? && interval
|
78
|
+
[*r, *w].each { |io| io.raise_timeout_error(interval) }
|
79
|
+
return
|
80
|
+
end
|
78
81
|
rescue IOError, SystemCallError
|
79
82
|
@selectables.reject!(&:closed?)
|
80
83
|
retry
|
@@ -108,7 +111,11 @@ class HTTPX::Selector
|
|
108
111
|
when nil then return
|
109
112
|
end
|
110
113
|
|
111
|
-
|
114
|
+
unless result || interval.nil?
|
115
|
+
io.raise_timeout_error(interval)
|
116
|
+
return
|
117
|
+
end
|
118
|
+
# raise HTTPX::TimeoutError.new(interval, "timed out while waiting on select")
|
112
119
|
|
113
120
|
yield io
|
114
121
|
rescue IOError, SystemCallError
|
data/lib/httpx/version.rb
CHANGED
data/sig/connection.rbs
CHANGED
data/sig/pool.rbs
CHANGED
@@ -36,9 +36,9 @@ module HTTPX
|
|
36
36
|
|
37
37
|
def unregister_connection: (Connection) -> void
|
38
38
|
|
39
|
-
def select_connection: (
|
39
|
+
def select_connection: (Selector::selectable) -> void
|
40
40
|
|
41
|
-
def deselect_connection: (
|
41
|
+
def deselect_connection: (Selector::selectable) -> Selector::selectable?
|
42
42
|
|
43
43
|
def coalesce_connections: (Connection coalescable, Connection coalescing) -> void
|
44
44
|
|
data/sig/resolver/native.rbs
CHANGED
@@ -27,6 +27,8 @@ module HTTPX
|
|
27
27
|
|
28
28
|
def timeout: () -> Numeric?
|
29
29
|
|
30
|
+
def raise_timeout_error: (Numeric interval) -> void
|
31
|
+
|
30
32
|
private
|
31
33
|
|
32
34
|
def initialize: (ip_family family, options options) -> void
|
@@ -35,7 +37,7 @@ module HTTPX
|
|
35
37
|
|
36
38
|
def consume: () -> void
|
37
39
|
|
38
|
-
def do_retry: () -> void
|
40
|
+
def do_retry: (?Numeric loop_time) -> void
|
39
41
|
|
40
42
|
def dread: (Integer) -> void
|
41
43
|
| () -> void
|
data/sig/selector.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: 0.20.
|
4
|
+
version: 0.20.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tiago Cardoso
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-07-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http-2-next
|
@@ -81,6 +81,9 @@ extra_rdoc_files:
|
|
81
81
|
- doc/release_notes/0_19_8.md
|
82
82
|
- doc/release_notes/0_1_0.md
|
83
83
|
- doc/release_notes/0_20_0.md
|
84
|
+
- doc/release_notes/0_20_1.md
|
85
|
+
- doc/release_notes/0_20_2.md
|
86
|
+
- doc/release_notes/0_20_3.md
|
84
87
|
- doc/release_notes/0_2_0.md
|
85
88
|
- doc/release_notes/0_2_1.md
|
86
89
|
- doc/release_notes/0_3_0.md
|
@@ -154,6 +157,9 @@ files:
|
|
154
157
|
- doc/release_notes/0_19_8.md
|
155
158
|
- doc/release_notes/0_1_0.md
|
156
159
|
- doc/release_notes/0_20_0.md
|
160
|
+
- doc/release_notes/0_20_1.md
|
161
|
+
- doc/release_notes/0_20_2.md
|
162
|
+
- doc/release_notes/0_20_3.md
|
157
163
|
- doc/release_notes/0_2_0.md
|
158
164
|
- doc/release_notes/0_2_1.md
|
159
165
|
- doc/release_notes/0_3_0.md
|