httpx 1.7.1 → 1.7.3
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/README.md +3 -1
- data/doc/release_notes/1_7_2.md +6 -0
- data/doc/release_notes/1_7_3.md +29 -0
- data/lib/httpx/adapters/webmock.rb +3 -4
- data/lib/httpx/connection/http1.rb +0 -1
- data/lib/httpx/connection/http2.rb +41 -30
- data/lib/httpx/connection.rb +18 -4
- data/lib/httpx/plugins/auth/digest.rb +2 -1
- data/lib/httpx/plugins/auth.rb +21 -2
- data/lib/httpx/plugins/cookies/cookie.rb +34 -11
- data/lib/httpx/plugins/cookies/jar.rb +93 -18
- data/lib/httpx/plugins/cookies.rb +7 -3
- data/lib/httpx/plugins/expect.rb +26 -2
- data/lib/httpx/plugins/fiber_concurrency.rb +2 -4
- data/lib/httpx/plugins/follow_redirects.rb +3 -1
- data/lib/httpx/plugins/ntlm_auth.rb +1 -1
- data/lib/httpx/plugins/rate_limiter.rb +19 -19
- data/lib/httpx/plugins/retries.rb +11 -7
- data/lib/httpx/plugins/ssrf_filter.rb +1 -0
- data/lib/httpx/plugins/stream_bidi.rb +17 -1
- data/lib/httpx/request.rb +1 -1
- data/lib/httpx/resolver/resolver.rb +5 -0
- data/lib/httpx/selector.rb +4 -4
- data/lib/httpx/session.rb +6 -5
- data/lib/httpx/version.rb +1 -1
- data/sig/chainable.rbs +1 -1
- data/sig/connection/http2.rbs +8 -4
- data/sig/connection.rbs +3 -0
- data/sig/plugins/auth.rbs +6 -0
- data/sig/plugins/cookies/cookie.rbs +3 -2
- data/sig/plugins/cookies/jar.rbs +11 -0
- data/sig/plugins/cookies.rbs +2 -0
- data/sig/plugins/expect.rbs +17 -2
- data/sig/plugins/proxy/socks4.rbs +4 -0
- data/sig/plugins/rate_limiter.rbs +2 -2
- data/sig/plugins/response_cache.rbs +3 -3
- data/sig/plugins/retries.rbs +17 -13
- data/sig/plugins/stream_bidi.rbs +3 -0
- data/sig/request.rbs +1 -0
- data/sig/resolver/native.rbs +2 -0
- data/sig/resolver/resolver.rbs +2 -2
- data/sig/selector.rbs +4 -0
- metadata +7 -3
|
@@ -46,7 +46,7 @@ module HTTPX
|
|
|
46
46
|
|
|
47
47
|
if probe_response.status == 401 && ntlm.can_authenticate?(probe_response.headers["www-authenticate"])
|
|
48
48
|
request.transition(:idle)
|
|
49
|
-
request.
|
|
49
|
+
request.unauthorize!
|
|
50
50
|
request.authorize(ntlm.authenticate(request, probe_response.headers["www-authenticate"]).encode("utf-8"))
|
|
51
51
|
super(request)
|
|
52
52
|
else
|
|
@@ -16,25 +16,7 @@ module HTTPX
|
|
|
16
16
|
|
|
17
17
|
class << self
|
|
18
18
|
def load_dependencies(klass)
|
|
19
|
-
klass.plugin(:retries
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
# Servers send the "Retry-After" header field to indicate how long the
|
|
23
|
-
# user agent ought to wait before making a follow-up request. When
|
|
24
|
-
# sent with a 503 (Service Unavailable) response, Retry-After indicates
|
|
25
|
-
# how long the service is expected to be unavailable to the client.
|
|
26
|
-
# When sent with any 3xx (Redirection) response, Retry-After indicates
|
|
27
|
-
# the minimum time that the user agent is asked to wait before issuing
|
|
28
|
-
# the redirected request.
|
|
29
|
-
#
|
|
30
|
-
def retry_after_rate_limit(_, response)
|
|
31
|
-
return unless response.is_a?(Response)
|
|
32
|
-
|
|
33
|
-
retry_after = response.headers["retry-after"]
|
|
34
|
-
|
|
35
|
-
return unless retry_after
|
|
36
|
-
|
|
37
|
-
Utils.parse_retry_after(retry_after)
|
|
19
|
+
klass.plugin(:retries)
|
|
38
20
|
end
|
|
39
21
|
end
|
|
40
22
|
|
|
@@ -52,6 +34,24 @@ module HTTPX
|
|
|
52
34
|
def rate_limit_error?(response)
|
|
53
35
|
response.is_a?(Response) && RATE_LIMIT_CODES.include?(response.status)
|
|
54
36
|
end
|
|
37
|
+
|
|
38
|
+
# Servers send the "Retry-After" header field to indicate how long the
|
|
39
|
+
# user agent ought to wait before making a follow-up request. When
|
|
40
|
+
# sent with a 503 (Service Unavailable) response, Retry-After indicates
|
|
41
|
+
# how long the service is expected to be unavailable to the client.
|
|
42
|
+
# When sent with any 3xx (Redirection) response, Retry-After indicates
|
|
43
|
+
# the minimum time that the user agent is asked to wait before issuing
|
|
44
|
+
# the redirected request.
|
|
45
|
+
#
|
|
46
|
+
def when_to_retry(_, response, options)
|
|
47
|
+
return super unless response.is_a?(Response)
|
|
48
|
+
|
|
49
|
+
retry_after = response.headers["retry-after"]
|
|
50
|
+
|
|
51
|
+
return super unless retry_after
|
|
52
|
+
|
|
53
|
+
Utils.parse_retry_after(retry_after)
|
|
54
|
+
end
|
|
55
55
|
end
|
|
56
56
|
end
|
|
57
57
|
|
|
@@ -148,10 +148,7 @@ module HTTPX
|
|
|
148
148
|
log { "failed to get response, #{request.retries} tries to go..." }
|
|
149
149
|
prepare_to_retry(request, response)
|
|
150
150
|
|
|
151
|
-
retry_after = options
|
|
152
|
-
retry_after = retry_after.call(request, response) if retry_after.respond_to?(:call)
|
|
153
|
-
|
|
154
|
-
if retry_after
|
|
151
|
+
if (retry_after = when_to_retry(request, response, options))
|
|
155
152
|
# apply jitter
|
|
156
153
|
if (jitter = request.options.retry_jitter)
|
|
157
154
|
retry_after = jitter.call(retry_after)
|
|
@@ -201,6 +198,12 @@ module HTTPX
|
|
|
201
198
|
request.transition(:idle)
|
|
202
199
|
end
|
|
203
200
|
|
|
201
|
+
def when_to_retry(request, response, options)
|
|
202
|
+
retry_after = options.retry_after
|
|
203
|
+
retry_after = retry_after.call(request, response) if retry_after.respond_to?(:call)
|
|
204
|
+
retry_after
|
|
205
|
+
end
|
|
206
|
+
|
|
204
207
|
#
|
|
205
208
|
# Attempt to set the request to perform a partial range request.
|
|
206
209
|
# This happens if the peer server accepts byte-range requests, and
|
|
@@ -237,14 +240,15 @@ module HTTPX
|
|
|
237
240
|
def initialize(*args)
|
|
238
241
|
super
|
|
239
242
|
@retries = @options.max_retries
|
|
243
|
+
@partial_response = nil
|
|
240
244
|
end
|
|
241
245
|
|
|
242
246
|
def response=(response)
|
|
243
|
-
if @partial_response
|
|
247
|
+
if (partial_response = @partial_response)
|
|
244
248
|
if response.is_a?(Response) && response.status == 206
|
|
245
|
-
response.from_partial_response(
|
|
249
|
+
response.from_partial_response(partial_response)
|
|
246
250
|
else
|
|
247
|
-
|
|
251
|
+
partial_response.close
|
|
248
252
|
end
|
|
249
253
|
@partial_response = nil
|
|
250
254
|
end
|
|
@@ -106,6 +106,7 @@ module HTTPX
|
|
|
106
106
|
error = ServerSideRequestForgeryError.new("#{request.uri} URI scheme not allowed")
|
|
107
107
|
error.set_backtrace(caller)
|
|
108
108
|
response = ErrorResponse.new(request, error)
|
|
109
|
+
request.response = response
|
|
109
110
|
request.emit(:response, response)
|
|
110
111
|
response
|
|
111
112
|
end
|
|
@@ -61,7 +61,7 @@ module HTTPX
|
|
|
61
61
|
def handle_stream(stream, request)
|
|
62
62
|
return super unless @options.stream
|
|
63
63
|
|
|
64
|
-
request.
|
|
64
|
+
request.flush_buffer_on_body do
|
|
65
65
|
next unless request.headers_sent
|
|
66
66
|
|
|
67
67
|
handle(request, stream)
|
|
@@ -189,6 +189,10 @@ module HTTPX
|
|
|
189
189
|
!@closed
|
|
190
190
|
end
|
|
191
191
|
|
|
192
|
+
def force_close(*)
|
|
193
|
+
terminate
|
|
194
|
+
end
|
|
195
|
+
|
|
192
196
|
def terminate
|
|
193
197
|
return if @closed
|
|
194
198
|
|
|
@@ -202,6 +206,8 @@ module HTTPX
|
|
|
202
206
|
terminate
|
|
203
207
|
end
|
|
204
208
|
|
|
209
|
+
alias_method :on_io_error, :on_error
|
|
210
|
+
|
|
205
211
|
# noop (the owner connection will take of it)
|
|
206
212
|
def handle_socket_timeout(interval); end
|
|
207
213
|
end
|
|
@@ -254,9 +260,14 @@ module HTTPX
|
|
|
254
260
|
super
|
|
255
261
|
@headers_sent = false
|
|
256
262
|
@closed = false
|
|
263
|
+
@flush_buffer_on_body_cb = nil
|
|
257
264
|
@mutex = Thread::Mutex.new
|
|
258
265
|
end
|
|
259
266
|
|
|
267
|
+
def flush_buffer_on_body(&cb)
|
|
268
|
+
@flush_buffer_on_body_cb = on(:body, &cb)
|
|
269
|
+
end
|
|
270
|
+
|
|
260
271
|
def closed?
|
|
261
272
|
return super unless @options.stream
|
|
262
273
|
|
|
@@ -280,6 +291,11 @@ module HTTPX
|
|
|
280
291
|
case nextstate
|
|
281
292
|
when :idle
|
|
282
293
|
headers_sent = false
|
|
294
|
+
|
|
295
|
+
if @flush_buffer_on_body_cb
|
|
296
|
+
callbacks(:body).delete(@flush_buffer_on_body_cb)
|
|
297
|
+
@flush_buffer_on_body_cb = nil
|
|
298
|
+
end
|
|
283
299
|
when :waiting_for_chunk
|
|
284
300
|
return unless @state == :body
|
|
285
301
|
when :body
|
data/lib/httpx/request.rb
CHANGED
|
@@ -91,7 +91,7 @@ module HTTPX
|
|
|
91
91
|
raise UnsupportedSchemeError, "#{@uri}: #{@uri.scheme}: unsupported URI scheme" unless ALLOWED_URI_SCHEMES.include?(@uri.scheme)
|
|
92
92
|
|
|
93
93
|
@state = :idle
|
|
94
|
-
@response = @peer_address = @informational_status = nil
|
|
94
|
+
@response = @drainer = @peer_address = @informational_status = nil
|
|
95
95
|
@ping = false
|
|
96
96
|
@persistent = @options.persistent
|
|
97
97
|
@active_timeouts = []
|
data/lib/httpx/selector.rb
CHANGED
|
@@ -204,8 +204,7 @@ module HTTPX
|
|
|
204
204
|
rescue IOError => e
|
|
205
205
|
(Array(r) + Array(w)).each do |sel|
|
|
206
206
|
# TODO: is there a way to cheaply find the IO associated with the error?
|
|
207
|
-
sel.
|
|
208
|
-
sel.force_close(true)
|
|
207
|
+
sel.on_io_error(e)
|
|
209
208
|
end
|
|
210
209
|
rescue StandardError => e
|
|
211
210
|
(Array(r) + Array(w)).each do |sel|
|
|
@@ -249,8 +248,9 @@ module HTTPX
|
|
|
249
248
|
when :rw then rw_wait(io, interval)
|
|
250
249
|
end
|
|
251
250
|
rescue IOError => e
|
|
252
|
-
io.
|
|
253
|
-
|
|
251
|
+
io.on_io_error(e)
|
|
252
|
+
|
|
253
|
+
return
|
|
254
254
|
rescue StandardError => e
|
|
255
255
|
io.on_error(e)
|
|
256
256
|
|
data/lib/httpx/session.rb
CHANGED
|
@@ -140,9 +140,10 @@ module HTTPX
|
|
|
140
140
|
end
|
|
141
141
|
selector.deregister(connection)
|
|
142
142
|
|
|
143
|
+
# do not check-in connections only created for Happy Eyeballs
|
|
143
144
|
return if cloned
|
|
144
145
|
|
|
145
|
-
return if @closing && connection.state == :closed
|
|
146
|
+
return if @closing && connection.state == :closed && !connection.used?
|
|
146
147
|
|
|
147
148
|
connection.log(level: 2) { "check-in connection##{connection.object_id}(#{connection.state}) in pool##{@pool.object_id}" }
|
|
148
149
|
@pool.checkin_connection(connection)
|
|
@@ -177,16 +178,15 @@ module HTTPX
|
|
|
177
178
|
|
|
178
179
|
# returns the HTTPX::Connection through which the +request+ should be sent through.
|
|
179
180
|
def find_connection(request_uri, selector, options)
|
|
180
|
-
log(level: 2) { "finding connection for #{request_uri}..." }
|
|
181
181
|
if (connection = selector.find_connection(request_uri, options))
|
|
182
182
|
connection.idling if connection.state == :closed
|
|
183
|
-
|
|
183
|
+
log(level: 2) { "found connection##{connection.object_id}(#{connection.state}) in selector##{selector.object_id}" }
|
|
184
184
|
return connection
|
|
185
185
|
end
|
|
186
186
|
|
|
187
187
|
connection = @pool.checkout_connection(request_uri, options)
|
|
188
188
|
|
|
189
|
-
|
|
189
|
+
log(level: 2) { "found connection##{connection.object_id}(#{connection.state}) in pool##{@pool.object_id}" }
|
|
190
190
|
|
|
191
191
|
case connection.state
|
|
192
192
|
when :idle
|
|
@@ -240,7 +240,7 @@ module HTTPX
|
|
|
240
240
|
|
|
241
241
|
return unless response && response.finished?
|
|
242
242
|
|
|
243
|
-
log(level: 2) { "response fetched" }
|
|
243
|
+
log(level: 2) { "response##{response.object_id} fetched" }
|
|
244
244
|
|
|
245
245
|
response
|
|
246
246
|
end
|
|
@@ -249,6 +249,7 @@ module HTTPX
|
|
|
249
249
|
def send_request(request, selector, options = request.options)
|
|
250
250
|
error = begin
|
|
251
251
|
catch(:resolve_error) do
|
|
252
|
+
log(level: 2) { "finding connection for request##{request.object_id}..." }
|
|
252
253
|
connection = find_connection(request.uri, selector, options)
|
|
253
254
|
connection.send(request)
|
|
254
255
|
end
|
data/lib/httpx/version.rb
CHANGED
data/sig/chainable.rbs
CHANGED
|
@@ -29,7 +29,7 @@ module HTTPX
|
|
|
29
29
|
| (:proxy, ?options) -> (Plugins::sessionProxy & Plugins::httpProxy)
|
|
30
30
|
| (:push_promise, ?options) -> Plugins::sessionPushPromise
|
|
31
31
|
| (:retries, ?options) -> Plugins::sessionRetries
|
|
32
|
-
| (:rate_limiter, ?options) ->
|
|
32
|
+
| (:rate_limiter, ?options) -> Plugins::sessionRateLimiter
|
|
33
33
|
| (:stream, ?options) -> Plugins::sessionStream
|
|
34
34
|
| (:stream_bidi, ?options) -> Plugins::sessionStreamBidi
|
|
35
35
|
| (:aws_sigv4, ?options) -> Plugins::awsSigV4Session
|
data/sig/connection/http2.rbs
CHANGED
|
@@ -79,6 +79,8 @@ module HTTPX
|
|
|
79
79
|
|
|
80
80
|
def on_stream_refuse: (::HTTP2::Stream stream, Request request, StandardError error) -> void
|
|
81
81
|
|
|
82
|
+
def on_stream_half_close: (::HTTP2::Stream stream, Request request) -> void
|
|
83
|
+
|
|
82
84
|
def on_stream_close: (::HTTP2::Stream stream, Request request, (Symbol | StandardError)? error) -> void
|
|
83
85
|
|
|
84
86
|
def on_frame: (string bytes) -> void
|
|
@@ -87,13 +89,15 @@ module HTTPX
|
|
|
87
89
|
|
|
88
90
|
def on_close: (Integer last_frame, Symbol? error, String? payload) -> void
|
|
89
91
|
|
|
90
|
-
def on_frame_sent: (::HTTP2::frame) -> void
|
|
92
|
+
def on_frame_sent: (::HTTP2::frame frame) -> void
|
|
93
|
+
|
|
94
|
+
def frame_with_extra_info: (::HTTP2::frame frame) -> Hash[Symbol, untyped]
|
|
91
95
|
|
|
92
|
-
def on_frame_received: (::HTTP2::frame) -> void
|
|
96
|
+
def on_frame_received: (::HTTP2::frame frame) -> void
|
|
93
97
|
|
|
94
|
-
def on_altsvc: (String origin, ::HTTP2::frame) -> void
|
|
98
|
+
def on_altsvc: (String origin, ::HTTP2::frame frame) -> void
|
|
95
99
|
|
|
96
|
-
def on_promise: (::HTTP2::Stream) -> void
|
|
100
|
+
def on_promise: (::HTTP2::Stream stream) -> void
|
|
97
101
|
|
|
98
102
|
def on_origin: (String) -> void
|
|
99
103
|
|
data/sig/connection.rbs
CHANGED
|
@@ -37,6 +37,7 @@ module HTTPX
|
|
|
37
37
|
@read_buffer: Buffer
|
|
38
38
|
@write_buffer: Buffer
|
|
39
39
|
@inflight: Integer
|
|
40
|
+
@max_concurrent_requests: Integer?
|
|
40
41
|
@keep_alive_timeout: Numeric?
|
|
41
42
|
@timeout: Numeric?
|
|
42
43
|
@current_timeout: Numeric?
|
|
@@ -119,6 +120,8 @@ module HTTPX
|
|
|
119
120
|
|
|
120
121
|
def on_error: (HTTPX::TimeoutError | Error | StandardError error, ?Request? request) -> void
|
|
121
122
|
|
|
123
|
+
def on_io_error: (IOError error) -> void
|
|
124
|
+
|
|
122
125
|
private
|
|
123
126
|
|
|
124
127
|
def initialize: (http_uri uri, Options options) -> void
|
data/sig/plugins/auth.rbs
CHANGED
|
@@ -31,6 +31,8 @@ module HTTPX
|
|
|
31
31
|
def cookie_value: () -> String
|
|
32
32
|
alias to_s cookie_value
|
|
33
33
|
|
|
34
|
+
def match?: (String | cookie_attributes name_or_options) -> bool
|
|
35
|
+
|
|
34
36
|
def valid_for_uri?: (http_uri uri) -> bool
|
|
35
37
|
|
|
36
38
|
def self.new: (Cookie) -> instance
|
|
@@ -41,8 +43,7 @@ module HTTPX
|
|
|
41
43
|
|
|
42
44
|
private
|
|
43
45
|
|
|
44
|
-
def initialize: (cookie_attributes) ->
|
|
45
|
-
| (_ToS, _ToS, ?cookie_attributes) -> untyped
|
|
46
|
+
def initialize: (_ToS name, _ToS value, ?cookie_attributes) -> void
|
|
46
47
|
|
|
47
48
|
def acceptable_from_uri?: (uri) -> bool
|
|
48
49
|
|
data/sig/plugins/cookies/jar.rbs
CHANGED
|
@@ -6,11 +6,20 @@ module HTTPX
|
|
|
6
6
|
include Enumerable[Cookie]
|
|
7
7
|
|
|
8
8
|
@cookies: Array[Cookie]
|
|
9
|
+
@mtx: Thread::Mutex
|
|
9
10
|
|
|
10
11
|
def parse: (String set_cookie) -> void
|
|
11
12
|
|
|
13
|
+
def get: (String | cookie_attributes name_or_options) -> Cookie?
|
|
14
|
+
|
|
15
|
+
def get_all: (String | cookie_attributes name_or_options) -> Array[Cookie]
|
|
16
|
+
|
|
17
|
+
def set: (_ToS | Cookie name, ?(cookie_attributes | _ToS) value_or_options) -> void
|
|
18
|
+
|
|
12
19
|
def add: (Cookie name, ?String path) -> void
|
|
13
20
|
|
|
21
|
+
def delete: (String | Cookie | cookie_attributes name_or_options) -> void
|
|
22
|
+
|
|
14
23
|
def []: (http_uri) -> Array[Cookie]
|
|
15
24
|
|
|
16
25
|
def each: (?http_uri?) { (Cookie) -> void } -> void
|
|
@@ -21,6 +30,8 @@ module HTTPX
|
|
|
21
30
|
private
|
|
22
31
|
|
|
23
32
|
def initialize: (?_Each[cookie] cookies) -> untyped
|
|
33
|
+
|
|
34
|
+
def synchronize: [T] { () -> T } -> T
|
|
24
35
|
end
|
|
25
36
|
end
|
|
26
37
|
end
|
data/sig/plugins/cookies.rbs
CHANGED
data/sig/plugins/expect.rbs
CHANGED
|
@@ -2,14 +2,29 @@ module HTTPX
|
|
|
2
2
|
module Plugins
|
|
3
3
|
module Expect
|
|
4
4
|
EXPECT_TIMEOUT: Integer
|
|
5
|
+
NOEXPECT_STORE_MUTEX: Thread::Mutex
|
|
6
|
+
|
|
7
|
+
self.@no_expect_store: Store
|
|
8
|
+
def self.no_expect_store: () -> Store
|
|
9
|
+
|
|
10
|
+
def self.extra_options: (Options) -> (Options & _ExpectOptions)
|
|
11
|
+
|
|
12
|
+
class Store
|
|
13
|
+
@store: Array[String]
|
|
14
|
+
@mutex: Thread::Mutex
|
|
15
|
+
|
|
16
|
+
def include?: (String host) -> bool
|
|
17
|
+
|
|
18
|
+
def add: (String host) -> void
|
|
19
|
+
|
|
20
|
+
def delete: (String host) -> void
|
|
21
|
+
end
|
|
5
22
|
|
|
6
23
|
interface _ExpectOptions
|
|
7
24
|
def expect_timeout: () -> Integer?
|
|
8
25
|
|
|
9
26
|
def expect_threshold_size: () -> Integer?
|
|
10
27
|
end
|
|
11
|
-
|
|
12
|
-
def self.extra_options: (Options) -> (Options & _ExpectOptions)
|
|
13
28
|
end
|
|
14
29
|
end
|
|
15
30
|
end
|
|
@@ -5,11 +5,11 @@ module HTTPX
|
|
|
5
5
|
|
|
6
6
|
def self.load_dependencies: (singleton(Session)) -> void
|
|
7
7
|
|
|
8
|
-
def self.retry_after_rate_limit: (untyped, response) -> Numeric?
|
|
9
|
-
|
|
10
8
|
module InstanceMethods
|
|
11
9
|
def rate_limit_error?: (response response) -> bool
|
|
12
10
|
end
|
|
13
11
|
end
|
|
12
|
+
|
|
13
|
+
type sessionRateLimiter = Session & RateLimiter::InstanceMethods
|
|
14
14
|
end
|
|
15
15
|
end
|
|
@@ -51,7 +51,7 @@ module HTTPX
|
|
|
51
51
|
module ResponseMethods
|
|
52
52
|
attr_writer original_request: cacheRequest
|
|
53
53
|
|
|
54
|
-
@
|
|
54
|
+
@cached: bool
|
|
55
55
|
@cache_control: Array[String]?
|
|
56
56
|
@vary: Array[String]?
|
|
57
57
|
@date: Time?
|
|
@@ -66,9 +66,9 @@ module HTTPX
|
|
|
66
66
|
|
|
67
67
|
def fresh?: () -> bool
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
%a{pure} def cache_control: () -> Array[String]?
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
%a{pure} def vary: () -> Array[String]?
|
|
72
72
|
|
|
73
73
|
private
|
|
74
74
|
|
data/sig/plugins/retries.rbs
CHANGED
|
@@ -8,16 +8,16 @@ module HTTPX
|
|
|
8
8
|
DEFAULT_JITTER: ^(Numeric) -> Numeric
|
|
9
9
|
BACKOFF_ALGORITHMS: Array[Symbol]
|
|
10
10
|
|
|
11
|
-
def self?.retry_after_polynomial_backoff: (retriesRequest request,
|
|
11
|
+
def self?.retry_after_polynomial_backoff: (retriesRequest request, retriesResponse response) -> Numeric
|
|
12
12
|
|
|
13
|
-
def self?.retry_after_exponential_backoff: (retriesRequest request,
|
|
13
|
+
def self?.retry_after_exponential_backoff: (retriesRequest request, retriesResponse response) -> Numeric
|
|
14
14
|
|
|
15
15
|
interface _RetryCallback
|
|
16
|
-
def call: (
|
|
16
|
+
def call: (retriesResponse response) -> bool?
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
interface _RetriesOptions
|
|
20
|
-
def retry_after: () -> (^(retriesRequest request,
|
|
20
|
+
def retry_after: () -> (^(retriesRequest request, retriesResponse response) -> Numeric | Numeric)?
|
|
21
21
|
|
|
22
22
|
def retry_jitter: () -> ^(Numeric jitter) -> Numeric
|
|
23
23
|
|
|
@@ -35,17 +35,19 @@ module HTTPX
|
|
|
35
35
|
|
|
36
36
|
private
|
|
37
37
|
|
|
38
|
-
def fetch_response: (retriesRequest request, Selector selector, retriesOptions options) ->
|
|
38
|
+
def fetch_response: (retriesRequest request, Selector selector, retriesOptions options) -> retriesResponse?
|
|
39
39
|
|
|
40
|
-
def retryable_request?: (retriesRequest request,
|
|
40
|
+
def retryable_request?: (retriesRequest request, retriesResponse response, retriesOptions options) -> boolish
|
|
41
41
|
|
|
42
|
-
def retryable_response?: (
|
|
42
|
+
def retryable_response?: (retriesResponse response, retriesOptions options) -> boolish
|
|
43
43
|
|
|
44
44
|
def retryable_error?: (_Exception error, Options options) -> boolish
|
|
45
45
|
|
|
46
|
-
def try_partial_retry: (retriesRequest request,
|
|
46
|
+
def try_partial_retry: (retriesRequest request, retriesResponse response) -> void
|
|
47
47
|
|
|
48
|
-
def prepare_to_retry: (Request & RequestMethods request,
|
|
48
|
+
def prepare_to_retry: (Request & RequestMethods request, retriesResponse response) -> void
|
|
49
|
+
|
|
50
|
+
def when_to_retry: (Request & RequestMethods request, retriesResponse response, retriesOptions options) -> void
|
|
49
51
|
end
|
|
50
52
|
|
|
51
53
|
module RequestMethods
|
|
@@ -53,20 +55,22 @@ module HTTPX
|
|
|
53
55
|
|
|
54
56
|
attr_accessor retries: Integer
|
|
55
57
|
|
|
56
|
-
attr_writer partial_response:
|
|
58
|
+
attr_writer partial_response: retriesResponse?
|
|
57
59
|
|
|
58
|
-
def response=: (retriesResponse
|
|
60
|
+
def response=: (retriesResponse response) -> void
|
|
59
61
|
end
|
|
60
62
|
|
|
61
63
|
module ResponseMethods
|
|
62
|
-
def from_partial_response: (
|
|
64
|
+
def from_partial_response: (retriesHTTPResponse response) -> void
|
|
63
65
|
end
|
|
64
66
|
|
|
65
67
|
type retriesOptions = Options & _RetriesOptions
|
|
66
68
|
|
|
67
69
|
type retriesRequest = Request & RequestMethods
|
|
68
70
|
|
|
69
|
-
type
|
|
71
|
+
type retriesHTTPResponse = Response & ResponseMethods
|
|
72
|
+
|
|
73
|
+
type retriesResponse = retriesHTTPResponse | ErrorResponse
|
|
70
74
|
end
|
|
71
75
|
|
|
72
76
|
type sessionRetries = Session & Retries::InstanceMethods
|
data/sig/plugins/stream_bidi.rbs
CHANGED
data/sig/request.rbs
CHANGED
data/sig/resolver/native.rbs
CHANGED
data/sig/resolver/resolver.rbs
CHANGED
|
@@ -27,8 +27,6 @@ module HTTPX
|
|
|
27
27
|
|
|
28
28
|
def terminate: () -> void
|
|
29
29
|
|
|
30
|
-
def force_close: (*untyped args) -> void
|
|
31
|
-
|
|
32
30
|
def closed?: () -> bool
|
|
33
31
|
|
|
34
32
|
def empty?: () -> bool
|
|
@@ -60,6 +58,8 @@ module HTTPX
|
|
|
60
58
|
def resolve_error: (String hostname, ?StandardError?) -> (ResolveError | ResolveTimeoutError)
|
|
61
59
|
|
|
62
60
|
def close_or_resolve: () -> void
|
|
61
|
+
|
|
62
|
+
def disconnect: () -> void
|
|
63
63
|
end
|
|
64
64
|
end
|
|
65
65
|
end
|
data/sig/selector.rbs
CHANGED