httpx 1.7.0 → 1.7.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_7_1.md +21 -0
- data/lib/httpx/adapters/webmock.rb +18 -9
- data/lib/httpx/altsvc.rb +1 -1
- data/lib/httpx/connection/http1.rb +4 -3
- data/lib/httpx/connection.rb +4 -1
- data/lib/httpx/io/tcp.rb +1 -1
- data/lib/httpx/options.rb +78 -5
- data/lib/httpx/parser/http1.rb +1 -0
- data/lib/httpx/plugins/auth.rb +28 -2
- data/lib/httpx/plugins/oauth.rb +11 -18
- data/lib/httpx/plugins/persistent.rb +3 -5
- data/lib/httpx/plugins/proxy/http.rb +0 -4
- data/lib/httpx/plugins/proxy.rb +3 -1
- data/lib/httpx/plugins/query.rb +1 -1
- data/lib/httpx/plugins/rate_limiter.rb +20 -15
- data/lib/httpx/plugins/retries.rb +8 -11
- data/lib/httpx/plugins/stream.rb +2 -2
- data/lib/httpx/plugins/stream_bidi.rb +13 -1
- data/lib/httpx/pool.rb +0 -1
- data/lib/httpx/request/body.rb +1 -1
- data/lib/httpx/resolver/cache/base.rb +136 -0
- data/lib/httpx/resolver/cache/memory.rb +42 -0
- data/lib/httpx/resolver/cache.rb +18 -0
- data/lib/httpx/resolver/https.rb +7 -3
- data/lib/httpx/resolver/multi.rb +7 -3
- data/lib/httpx/resolver/native.rb +6 -2
- data/lib/httpx/resolver/resolver.rb +1 -1
- data/lib/httpx/resolver.rb +3 -149
- data/lib/httpx/response/body.rb +3 -3
- data/lib/httpx/selector.rb +5 -3
- data/lib/httpx/session.rb +1 -1
- data/lib/httpx/timers.rb +6 -12
- data/lib/httpx/transcoder/gzip.rb +7 -2
- data/lib/httpx/transcoder/multipart/decoder.rb +1 -1
- data/lib/httpx/transcoder/multipart.rb +1 -1
- data/lib/httpx/utils.rb +13 -0
- data/lib/httpx/version.rb +1 -1
- data/sig/altsvc.rbs +7 -4
- data/sig/loggable.rbs +1 -1
- data/sig/options.rbs +11 -3
- data/sig/plugins/auth.rbs +10 -1
- data/sig/plugins/oauth.rbs +0 -2
- data/sig/plugins/rate_limiter.rbs +4 -2
- data/sig/plugins/retries.rbs +4 -2
- data/sig/resolver/cache/base.rbs +28 -0
- data/sig/resolver/cache/memory.rbs +13 -0
- data/sig/resolver/cache.rbs +16 -0
- data/sig/resolver/https.rbs +19 -0
- data/sig/resolver/multi.rbs +6 -0
- data/sig/resolver.rbs +0 -24
- data/sig/timers.rbs +1 -1
- data/sig/utils.rbs +2 -0
- metadata +9 -1
data/sig/loggable.rbs
CHANGED
data/sig/options.rbs
CHANGED
|
@@ -17,11 +17,13 @@ module HTTPX
|
|
|
17
17
|
|
|
18
18
|
DEFAULT_OPTIONS: Hash[Symbol, untyped]
|
|
19
19
|
REQUEST_BODY_IVARS: Array[Symbol]
|
|
20
|
+
RESOLVER_TYPES: Array[Symbol]
|
|
20
21
|
USER_AGENT: String
|
|
21
22
|
|
|
22
23
|
type timeout_type = :connect_timeout | :settings_timeout | :close_handshake_timeout | :operation_timeout | :keep_alive_timeout | :read_timeout | :write_timeout | :request_timeout
|
|
23
24
|
type timeout = Hash[timeout_type, Numeric?]
|
|
24
25
|
type redact_value = :headers | :body | bool
|
|
26
|
+
type resolver_cache_option = :memory | :file | (Object & Resolver::_Cache)
|
|
25
27
|
|
|
26
28
|
def self.new: (?options) -> instance
|
|
27
29
|
|
|
@@ -102,8 +104,6 @@ module HTTPX
|
|
|
102
104
|
|
|
103
105
|
attr_reader options_class: singleton(Options)
|
|
104
106
|
|
|
105
|
-
attr_reader resolver_class: Symbol | singleton(Resolver::Resolver)
|
|
106
|
-
|
|
107
107
|
attr_reader ssl: Hash[Symbol, untyped]
|
|
108
108
|
|
|
109
109
|
# io
|
|
@@ -134,6 +134,12 @@ module HTTPX
|
|
|
134
134
|
# ip_families
|
|
135
135
|
attr_reader ip_families: Array[ip_family]?
|
|
136
136
|
|
|
137
|
+
@resolver_cache: resolver_cache_option
|
|
138
|
+
|
|
139
|
+
def resolver_class: () -> singleton(Resolver::Resolver)
|
|
140
|
+
|
|
141
|
+
def resolver_cache: () -> (Object & Resolver::_Cache)
|
|
142
|
+
|
|
137
143
|
def ==: (Options other) -> bool
|
|
138
144
|
|
|
139
145
|
def options_equals?: (Options other, ?Array[Symbol] ignore_ivars) -> bool
|
|
@@ -148,7 +154,7 @@ module HTTPX
|
|
|
148
154
|
|
|
149
155
|
def initialize: (?options options) -> void
|
|
150
156
|
|
|
151
|
-
def do_initialize: (
|
|
157
|
+
def do_initialize: () -> void
|
|
152
158
|
|
|
153
159
|
def access_option: (Hash[Symbol, untyped] | Object | nil obj, Symbol k, Hash[Symbol, Symbol]? ivar_map) -> untyped
|
|
154
160
|
|
|
@@ -185,6 +191,8 @@ module HTTPX
|
|
|
185
191
|
def option_persistent: (bool value) -> bool
|
|
186
192
|
def option_close_on_fork: (bool value) -> bool
|
|
187
193
|
|
|
194
|
+
def option_resolver_cache: (resolver_cache_option value) -> resolver_cache_option
|
|
195
|
+
|
|
188
196
|
def option_origin: (http_uri | String value) -> http_uri
|
|
189
197
|
|
|
190
198
|
def option_base_path: (_ToStr value) -> String
|
data/sig/plugins/auth.rbs
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
module HTTPX
|
|
2
2
|
module Plugins
|
|
3
3
|
module Auth
|
|
4
|
+
type auth_header_value_type = String | ^(Request request) -> string
|
|
5
|
+
|
|
4
6
|
interface _AuthOptions
|
|
5
|
-
def auth_header_value: () ->
|
|
7
|
+
def auth_header_value: () -> auth_header_value_type?
|
|
6
8
|
|
|
7
9
|
def auth_header_type: () -> String?
|
|
8
10
|
end
|
|
@@ -22,6 +24,8 @@ module HTTPX
|
|
|
22
24
|
private
|
|
23
25
|
|
|
24
26
|
def generate_auth_token: () -> String?
|
|
27
|
+
|
|
28
|
+
def dynamic_auth_token?: (auth_header_value_type auth_header_value) -> boolish
|
|
25
29
|
end
|
|
26
30
|
|
|
27
31
|
module RequestMethods
|
|
@@ -29,6 +33,11 @@ module HTTPX
|
|
|
29
33
|
end
|
|
30
34
|
|
|
31
35
|
module AuthRetries
|
|
36
|
+
module InstanceMethods
|
|
37
|
+
private
|
|
38
|
+
|
|
39
|
+
def auth_error?: (response response, Options options) -> boolish
|
|
40
|
+
end
|
|
32
41
|
end
|
|
33
42
|
end
|
|
34
43
|
|
data/sig/plugins/oauth.rbs
CHANGED
|
@@ -5,9 +5,11 @@ module HTTPX
|
|
|
5
5
|
|
|
6
6
|
def self.load_dependencies: (singleton(Session)) -> void
|
|
7
7
|
|
|
8
|
-
def self.retry_on_rate_limited_response?: (_Response) -> bool
|
|
9
|
-
|
|
10
8
|
def self.retry_after_rate_limit: (untyped, response) -> Numeric?
|
|
9
|
+
|
|
10
|
+
module InstanceMethods
|
|
11
|
+
def rate_limit_error?: (response response) -> bool
|
|
12
|
+
end
|
|
11
13
|
end
|
|
12
14
|
end
|
|
13
15
|
end
|
data/sig/plugins/retries.rbs
CHANGED
|
@@ -37,9 +37,11 @@ module HTTPX
|
|
|
37
37
|
|
|
38
38
|
def fetch_response: (retriesRequest request, Selector selector, retriesOptions options) -> (retriesResponse | ErrorResponse)?
|
|
39
39
|
|
|
40
|
-
def
|
|
40
|
+
def retryable_request?: (retriesRequest request, response response, retriesOptions options) -> boolish
|
|
41
41
|
|
|
42
|
-
def
|
|
42
|
+
def retryable_response?: (response response, retriesOptions options) -> boolish
|
|
43
|
+
|
|
44
|
+
def retryable_error?: (_Exception error, Options options) -> boolish
|
|
43
45
|
|
|
44
46
|
def try_partial_retry: (retriesRequest request, (retriesResponse | ErrorResponse) response) -> void
|
|
45
47
|
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
module HTTPX
|
|
2
|
+
module Resolver
|
|
3
|
+
class Cache::Base
|
|
4
|
+
include _Cache
|
|
5
|
+
|
|
6
|
+
MAX_CACHE_SIZE: Integer
|
|
7
|
+
|
|
8
|
+
CACHE_MUTEX: Thread::Mutex
|
|
9
|
+
HOSTS: Resolv::Hosts
|
|
10
|
+
|
|
11
|
+
self.@cache: instance?
|
|
12
|
+
|
|
13
|
+
def self.cache: (Symbol label) -> instance
|
|
14
|
+
|
|
15
|
+
private
|
|
16
|
+
|
|
17
|
+
def ip_resolve: (String hostname) -> Array[Entry]?
|
|
18
|
+
|
|
19
|
+
def hosts_resolve: (String hostname) -> Array[Entry]?
|
|
20
|
+
|
|
21
|
+
def _get: (String hostname, Hash[String, Array[dns_result]] lookups, Array[String] hostnames, Numeric ttl) -> Array[Entry]?
|
|
22
|
+
|
|
23
|
+
def _set: (String hostname, ip_family family, Array[dns_result] entries, Hash[String, Array[dns_result]] lookups, Array[String] hostnames) -> void
|
|
24
|
+
|
|
25
|
+
def _evict: (String hostname, String ip, Hash[String, Array[dns_result]] lookups, Array[String] hostnames) -> void
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module HTTPX::Resolver
|
|
2
|
+
module Cache
|
|
3
|
+
class Memory < Base
|
|
4
|
+
@lookup_mutex: Thread::Mutex
|
|
5
|
+
@hostnames: Array[String]
|
|
6
|
+
@lookups: Hash[String, Array[dns_result]]
|
|
7
|
+
|
|
8
|
+
private
|
|
9
|
+
|
|
10
|
+
def synchronize: [U] () { (Hash[String, Array[dns_result]] lookups, Array[String] hostnames) -> U } -> U
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module HTTPX
|
|
2
|
+
module Resolver
|
|
3
|
+
module Cache
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
interface _Cache
|
|
7
|
+
def resolve: (String hostname) -> Array[Entry]?
|
|
8
|
+
|
|
9
|
+
def get: (String hostname) -> Array[Entry]?
|
|
10
|
+
|
|
11
|
+
def set: (String hostname, ip_family family, Array[dns_result] addresses) -> void
|
|
12
|
+
|
|
13
|
+
def evict: (String hostname, _ToS ip) -> void
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
data/sig/resolver/https.rbs
CHANGED
|
@@ -26,6 +26,25 @@ module HTTPX
|
|
|
26
26
|
|
|
27
27
|
def <<: (Connection) -> void
|
|
28
28
|
|
|
29
|
+
# delegated to resolver connection
|
|
30
|
+
def connecting?: () -> bool
|
|
31
|
+
|
|
32
|
+
def to_io: () -> IO
|
|
33
|
+
|
|
34
|
+
def call: () -> void
|
|
35
|
+
|
|
36
|
+
def close: () -> void
|
|
37
|
+
|
|
38
|
+
# def closed?: () -> bool
|
|
39
|
+
|
|
40
|
+
def deactivate: () -> void
|
|
41
|
+
|
|
42
|
+
def terminate: () -> void
|
|
43
|
+
|
|
44
|
+
def inflight?: () -> bool
|
|
45
|
+
|
|
46
|
+
def handle_socket_timeout: (Numeric interval) -> void
|
|
47
|
+
|
|
29
48
|
private
|
|
30
49
|
|
|
31
50
|
def initialize: (ip_family family, options options) -> void
|
data/sig/resolver/multi.rbs
CHANGED
|
@@ -20,6 +20,12 @@ module HTTPX
|
|
|
20
20
|
def early_resolve: (Connection connection) -> bool
|
|
21
21
|
|
|
22
22
|
def lazy_resolve: (Connection connection) -> void
|
|
23
|
+
|
|
24
|
+
private
|
|
25
|
+
|
|
26
|
+
def nolookup_resolve: (String hostname, Options options) -> Array[Entry]?
|
|
27
|
+
|
|
28
|
+
def initialize: (singleton(Native) | singleton(HTTPS) resolver_type, Options options) -> void
|
|
23
29
|
end
|
|
24
30
|
end
|
|
25
31
|
end
|
data/sig/resolver.rbs
CHANGED
|
@@ -8,11 +8,7 @@ module HTTPX
|
|
|
8
8
|
| { "name" => String, "TTL" => Numeric, "data" => String }
|
|
9
9
|
|
|
10
10
|
RESOLVE_TIMEOUT: Array[Integer]
|
|
11
|
-
MAX_CACHE_SIZE: Integer
|
|
12
11
|
|
|
13
|
-
self.@lookup_mutex: Thread::Mutex
|
|
14
|
-
self.@hostnames: Array[String]
|
|
15
|
-
self.@lookups: Hash[String, Array[dns_result]]
|
|
16
12
|
self.@identifier_mutex: Thread::Mutex
|
|
17
13
|
self.@identifier: Integer
|
|
18
14
|
self.@hosts_resolver: Resolv::Hosts
|
|
@@ -20,24 +16,8 @@ module HTTPX
|
|
|
20
16
|
|
|
21
17
|
type dns_decoding_response = [:ok, Array[dns_result]] | [:decode_error, Resolv::DNS::DecodeError] | [:retriable_error | :dns_error, Integer] | Symbol
|
|
22
18
|
|
|
23
|
-
def self?.nolookup_resolve: (String hostname) -> Array[Entry]?
|
|
24
|
-
|
|
25
|
-
def self?.ip_resolve: (String hostname) -> Array[Entry]?
|
|
26
|
-
|
|
27
|
-
def self?.hosts_resolve: (String hostname) -> Array[Entry]?
|
|
28
|
-
|
|
29
19
|
def self?.supported_ip_families: () -> Array[ip_family]
|
|
30
20
|
|
|
31
|
-
def self?.resolver_for: (Symbol | singleton(Resolver) resolver_type, Options options) -> singleton(Resolver)
|
|
32
|
-
|
|
33
|
-
def self?.cached_lookup: (String hostname) -> Array[Entry]?
|
|
34
|
-
|
|
35
|
-
def self?.cached_lookup_set: (String hostname, ip_family family, Array[dns_result] addresses) -> void
|
|
36
|
-
|
|
37
|
-
def self?.cached_lookup_evict: (String hostname, _ToS ip) -> void
|
|
38
|
-
|
|
39
|
-
def self?.lookup: (String hostname, Hash[String, Array[dns_result]] lookups, Array[String] hostnames, Numeric ttl) -> Array[Entry]?
|
|
40
|
-
|
|
41
21
|
def self?.generate_id: () -> Integer
|
|
42
22
|
|
|
43
23
|
def self?.encode_dns_query: (String hostname, ?type: dns_resource, ?message_id: Integer) -> String
|
|
@@ -46,12 +26,8 @@ module HTTPX
|
|
|
46
26
|
|
|
47
27
|
private
|
|
48
28
|
|
|
49
|
-
def self?.lookup_synchronize: [U] () { (Hash[String, Array[dns_result]] lookups, Array[String] hostnames) -> U } -> U
|
|
50
|
-
|
|
51
29
|
def self?.id_synchronize: () { () -> void } -> void
|
|
52
30
|
|
|
53
|
-
def in_ractor?: () -> bool
|
|
54
|
-
|
|
55
31
|
def find_supported_ip_families: () -> Array[Integer]
|
|
56
32
|
end
|
|
57
33
|
end
|
data/sig/timers.rbs
CHANGED
data/sig/utils.rbs
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: httpx
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.7.
|
|
4
|
+
version: 1.7.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tiago Cardoso
|
|
@@ -160,6 +160,7 @@ extra_rdoc_files:
|
|
|
160
160
|
- doc/release_notes/1_6_2.md
|
|
161
161
|
- doc/release_notes/1_6_3.md
|
|
162
162
|
- doc/release_notes/1_7_0.md
|
|
163
|
+
- doc/release_notes/1_7_1.md
|
|
163
164
|
files:
|
|
164
165
|
- LICENSE.txt
|
|
165
166
|
- README.md
|
|
@@ -292,6 +293,7 @@ files:
|
|
|
292
293
|
- doc/release_notes/1_6_2.md
|
|
293
294
|
- doc/release_notes/1_6_3.md
|
|
294
295
|
- doc/release_notes/1_7_0.md
|
|
296
|
+
- doc/release_notes/1_7_1.md
|
|
295
297
|
- lib/httpx.rb
|
|
296
298
|
- lib/httpx/adapters/datadog.rb
|
|
297
299
|
- lib/httpx/adapters/faraday.rb
|
|
@@ -373,6 +375,9 @@ files:
|
|
|
373
375
|
- lib/httpx/request.rb
|
|
374
376
|
- lib/httpx/request/body.rb
|
|
375
377
|
- lib/httpx/resolver.rb
|
|
378
|
+
- lib/httpx/resolver/cache.rb
|
|
379
|
+
- lib/httpx/resolver/cache/base.rb
|
|
380
|
+
- lib/httpx/resolver/cache/memory.rb
|
|
376
381
|
- lib/httpx/resolver/entry.rb
|
|
377
382
|
- lib/httpx/resolver/https.rb
|
|
378
383
|
- lib/httpx/resolver/multi.rb
|
|
@@ -474,6 +479,9 @@ files:
|
|
|
474
479
|
- sig/request.rbs
|
|
475
480
|
- sig/request/body.rbs
|
|
476
481
|
- sig/resolver.rbs
|
|
482
|
+
- sig/resolver/cache.rbs
|
|
483
|
+
- sig/resolver/cache/base.rbs
|
|
484
|
+
- sig/resolver/cache/memory.rbs
|
|
477
485
|
- sig/resolver/entry.rbs
|
|
478
486
|
- sig/resolver/https.rbs
|
|
479
487
|
- sig/resolver/multi.rbs
|