httpx 1.6.2 → 1.7.0

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.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/doc/release_notes/0_11_0.md +3 -3
  3. data/doc/release_notes/1_6_3.md +47 -0
  4. data/doc/release_notes/1_7_0.md +149 -0
  5. data/lib/httpx/adapters/datadog.rb +1 -1
  6. data/lib/httpx/adapters/faraday.rb +1 -1
  7. data/lib/httpx/adapters/sentry.rb +1 -1
  8. data/lib/httpx/altsvc.rb +3 -1
  9. data/lib/httpx/connection/http1.rb +14 -15
  10. data/lib/httpx/connection/http2.rb +16 -15
  11. data/lib/httpx/connection.rb +118 -110
  12. data/lib/httpx/domain_name.rb +1 -1
  13. data/lib/httpx/extensions.rb +0 -14
  14. data/lib/httpx/headers.rb +2 -2
  15. data/lib/httpx/io/ssl.rb +1 -1
  16. data/lib/httpx/loggable.rb +14 -2
  17. data/lib/httpx/options.rb +60 -17
  18. data/lib/httpx/plugins/auth/digest.rb +44 -4
  19. data/lib/httpx/plugins/auth.rb +87 -4
  20. data/lib/httpx/plugins/aws_sdk_authentication.rb +0 -1
  21. data/lib/httpx/plugins/callbacks.rb +15 -1
  22. data/lib/httpx/plugins/cookies/cookie.rb +1 -0
  23. data/lib/httpx/plugins/digest_auth.rb +4 -5
  24. data/lib/httpx/plugins/fiber_concurrency.rb +16 -1
  25. data/lib/httpx/plugins/grpc/grpc_encoding.rb +1 -1
  26. data/lib/httpx/plugins/grpc.rb +2 -2
  27. data/lib/httpx/plugins/internal_telemetry.rb +1 -1
  28. data/lib/httpx/plugins/ntlm_auth.rb +5 -3
  29. data/lib/httpx/plugins/oauth.rb +162 -56
  30. data/lib/httpx/plugins/proxy/http.rb +37 -9
  31. data/lib/httpx/plugins/rate_limiter.rb +2 -2
  32. data/lib/httpx/plugins/response_cache/file_store.rb +1 -0
  33. data/lib/httpx/plugins/response_cache.rb +16 -9
  34. data/lib/httpx/plugins/retries.rb +55 -16
  35. data/lib/httpx/plugins/ssrf_filter.rb +1 -1
  36. data/lib/httpx/plugins/stream.rb +59 -8
  37. data/lib/httpx/plugins/stream_bidi.rb +87 -22
  38. data/lib/httpx/pool.rb +65 -21
  39. data/lib/httpx/request.rb +13 -14
  40. data/lib/httpx/resolver/https.rb +100 -34
  41. data/lib/httpx/resolver/multi.rb +12 -27
  42. data/lib/httpx/resolver/native.rb +68 -38
  43. data/lib/httpx/resolver/resolver.rb +46 -29
  44. data/lib/httpx/resolver/system.rb +63 -39
  45. data/lib/httpx/resolver.rb +97 -29
  46. data/lib/httpx/response/body.rb +2 -0
  47. data/lib/httpx/response.rb +22 -6
  48. data/lib/httpx/selector.rb +44 -20
  49. data/lib/httpx/session.rb +23 -33
  50. data/lib/httpx/transcoder/body.rb +1 -1
  51. data/lib/httpx/transcoder/deflate.rb +13 -8
  52. data/lib/httpx/transcoder/json.rb +1 -1
  53. data/lib/httpx/transcoder/multipart/decoder.rb +4 -4
  54. data/lib/httpx/transcoder/multipart/encoder.rb +1 -1
  55. data/lib/httpx/transcoder/multipart.rb +16 -8
  56. data/lib/httpx/transcoder/utils/body_reader.rb +1 -2
  57. data/lib/httpx/transcoder/utils/deflater.rb +1 -2
  58. data/lib/httpx/transcoder.rb +4 -6
  59. data/lib/httpx/version.rb +1 -1
  60. data/sig/altsvc.rbs +3 -0
  61. data/sig/chainable.rbs +3 -3
  62. data/sig/connection.rbs +13 -6
  63. data/sig/loggable.rbs +5 -1
  64. data/sig/options.rbs +6 -2
  65. data/sig/plugins/auth/digest.rbs +6 -0
  66. data/sig/plugins/auth.rbs +28 -4
  67. data/sig/plugins/basic_auth.rbs +3 -3
  68. data/sig/plugins/callbacks.rbs +3 -0
  69. data/sig/plugins/digest_auth.rbs +2 -4
  70. data/sig/plugins/fiber_concurrency.rbs +6 -0
  71. data/sig/plugins/ntlm_auth.rbs +2 -2
  72. data/sig/plugins/oauth.rbs +46 -15
  73. data/sig/plugins/rate_limiter.rbs +1 -1
  74. data/sig/plugins/response_cache/file_store.rbs +2 -0
  75. data/sig/plugins/response_cache.rbs +4 -0
  76. data/sig/plugins/retries.rbs +8 -2
  77. data/sig/plugins/stream.rbs +13 -3
  78. data/sig/plugins/stream_bidi.rbs +5 -7
  79. data/sig/pool.rbs +1 -1
  80. data/sig/resolver/https.rbs +7 -0
  81. data/sig/resolver/multi.rbs +2 -9
  82. data/sig/resolver/native.rbs +1 -1
  83. data/sig/resolver/resolver.rbs +9 -8
  84. data/sig/resolver/system.rbs +4 -2
  85. data/sig/resolver.rbs +12 -3
  86. data/sig/response.rbs +3 -0
  87. data/sig/selector.rbs +2 -0
  88. data/sig/session.rbs +8 -8
  89. data/sig/transcoder/multipart.rbs +4 -2
  90. data/sig/transcoder.rbs +5 -1
  91. metadata +5 -1
@@ -1,7 +1,6 @@
1
1
  module HTTPX
2
2
  module Resolver
3
3
  class Resolver
4
- include Callbacks
5
4
  include Loggable
6
5
 
7
6
  include _Selectable
@@ -26,7 +25,9 @@ module HTTPX
26
25
 
27
26
  def close: () -> void
28
27
 
29
- alias terminate close
28
+ def terminate: () -> void
29
+
30
+ def force_close: (*untyped args) -> void
30
31
 
31
32
  def closed?: () -> bool
32
33
 
@@ -36,8 +37,12 @@ module HTTPX
36
37
 
37
38
  def emit_addresses: (Connection connection, ip_family family, Array[ipaddr], ?bool early_resolve) -> void
38
39
 
40
+ def handle_error: (ResolveError | StandardError) -> void
41
+
39
42
  def self.multi?: () -> bool
40
43
 
44
+ def early_resolve: (Connection connection, ?hostname: String) -> bool
45
+
41
46
  private
42
47
 
43
48
  def resolve: (?Connection connection, ?String hostname) -> void
@@ -46,19 +51,15 @@ module HTTPX
46
51
 
47
52
  def initialize: (ip_family family, Options options) -> void
48
53
 
49
- def early_resolve: (Connection connection, ?hostname: String) -> bool
50
-
51
- def set_resolver_callbacks: () -> void
52
-
53
54
  def resolve_connection: (Connection connection) -> void
54
55
 
55
56
  def emit_connection_error: (Connection connection, StandardError error) -> void
56
57
 
57
- def close_resolver: (Resolver resolver) -> void
58
-
59
58
  def emit_resolve_error: (Connection connection, ?String hostname, ?StandardError) -> void
60
59
 
61
60
  def resolve_error: (String hostname, ?StandardError?) -> (ResolveError | ResolveTimeoutError)
61
+
62
+ def close_or_resolve: () -> void
62
63
  end
63
64
  end
64
65
  end
@@ -16,7 +16,9 @@ module HTTPX
16
16
 
17
17
  attr_reader state: Symbol
18
18
 
19
- def <<: (Connection) -> void
19
+ def initialize: (Options options) -> void
20
+
21
+ def lazy_resolve: (Connection connection) -> void
20
22
 
21
23
  private
22
24
 
@@ -28,7 +30,7 @@ module HTTPX
28
30
 
29
31
  def __addrinfo_resolve: (String host, String scheme) -> Array[Addrinfo]
30
32
 
31
- def initialize: (Options options) -> void
33
+ def close_or_resolve: () -> void
32
34
  end
33
35
  end
34
36
  end
data/sig/resolver.rbs CHANGED
@@ -8,14 +8,17 @@ module HTTPX
8
8
  | { "name" => String, "TTL" => Numeric, "data" => String }
9
9
 
10
10
  RESOLVE_TIMEOUT: Array[Integer]
11
+ MAX_CACHE_SIZE: Integer
11
12
 
12
13
  self.@lookup_mutex: Thread::Mutex
14
+ self.@hostnames: Array[String]
13
15
  self.@lookups: Hash[String, Array[dns_result]]
14
16
  self.@identifier_mutex: Thread::Mutex
15
17
  self.@identifier: Integer
16
18
  self.@hosts_resolver: Resolv::Hosts
19
+ self.@supported_ip_families: Array[Integer]
17
20
 
18
- type dns_decoding_response = [:ok, Array[dns_result]] | [:decode_error, Resolv::DNS::DecodeError] | [:dns_error, Integer] | Symbol
21
+ type dns_decoding_response = [:ok, Array[dns_result]] | [:decode_error, Resolv::DNS::DecodeError] | [:retriable_error | :dns_error, Integer] | Symbol
19
22
 
20
23
  def self?.nolookup_resolve: (String hostname) -> Array[Entry]?
21
24
 
@@ -33,7 +36,7 @@ module HTTPX
33
36
 
34
37
  def self?.cached_lookup_evict: (String hostname, _ToS ip) -> void
35
38
 
36
- def self?.lookup: (String hostname, Hash[String, Array[dns_result]] lookups, Numeric ttl) -> Array[Entry]?
39
+ def self?.lookup: (String hostname, Hash[String, Array[dns_result]] lookups, Array[String] hostnames, Numeric ttl) -> Array[Entry]?
37
40
 
38
41
  def self?.generate_id: () -> Integer
39
42
 
@@ -41,8 +44,14 @@ module HTTPX
41
44
 
42
45
  def self?.decode_dns_answer: (String) -> dns_decoding_response
43
46
 
44
- def self?.lookup_synchronize: [U] () { (Hash[String, Array[dns_result]] lookups) -> U } -> U
47
+ private
48
+
49
+ def self?.lookup_synchronize: [U] () { (Hash[String, Array[dns_result]] lookups, Array[String] hostnames) -> U } -> U
45
50
 
46
51
  def self?.id_synchronize: () { () -> void } -> void
52
+
53
+ def in_ractor?: () -> bool
54
+
55
+ def find_supported_ip_families: () -> Array[Integer]
47
56
  end
48
57
  end
data/sig/response.rbs CHANGED
@@ -63,6 +63,7 @@ module HTTPX
63
63
  @header_value: String?
64
64
  @mime_type: String?
65
65
  @charset: String?
66
+ @initialized: bool
66
67
 
67
68
  def mime_type: () -> String?
68
69
 
@@ -71,6 +72,8 @@ module HTTPX
71
72
  private
72
73
 
73
74
  def initialize: (String? header_value) -> void
75
+
76
+ def load: () -> void
74
77
  end
75
78
 
76
79
  class ErrorResponse
data/sig/selector.rbs CHANGED
@@ -11,6 +11,8 @@ module HTTPX
11
11
  def timeout: () -> Numeric?
12
12
 
13
13
  def handle_socket_timeout: (Numeric interval) -> void
14
+
15
+ def on_error: (StandardError) -> void
14
16
  end
15
17
 
16
18
  class Selector
data/sig/session.rbs CHANGED
@@ -15,6 +15,8 @@ module HTTPX
15
15
  @wrapped: bool
16
16
  @closing: bool
17
17
 
18
+ type resolver = Resolver::Multi | Resolver::Resolver
19
+
18
20
  def wrap: () { (instance) -> void } -> void
19
21
 
20
22
  def close: (?Selector selector) -> void
@@ -23,11 +25,11 @@ module HTTPX
23
25
 
24
26
  def select_connection: (Connection connection, Selector selector) -> void
25
27
 
26
- def pin_connection: (Resolver::Resolver | Connection connection, Selector selector) -> void
28
+ def pin: (resolver | Connection conn_or_resolver, Selector selector) -> void
27
29
 
28
30
  def deselect_connection: (Connection connection, Selector selector, ?bool cloned) -> void
29
31
 
30
- def select_resolver: (Resolver::Native | Resolver::HTTPS resolver, Selector selector) -> void
32
+ def select_resolver: (Resolver::Resolver resolver, Selector selector) -> void
31
33
 
32
34
  def deselect_resolver: (Resolver::Resolver resolver, Selector selector) -> void
33
35
 
@@ -53,10 +55,8 @@ module HTTPX
53
55
  def set_request_callbacks: (Request request) -> void
54
56
 
55
57
  def build_requests: (verb, uri, request_params) -> Array[Request]
56
- | (Array[[verb, uri, request_params]], Hash[Symbol, untyped]) -> Array[Request]
57
- | (Array[[verb, uri]], request_params) -> Array[Request]
58
- | (verb, _Each[[uri, request_params]], Hash[Symbol, untyped]) -> Array[Request]
59
- | (verb, _Each[uri], request_params) -> Array[Request]
58
+ | (Array[[verb, uri] | [verb, uri, request_params]], ?request_params) -> Array[Request]
59
+ | (verb, _Each[[uri] | [uri, request_params]], request_params) -> Array[Request]
60
60
 
61
61
  def do_init_connection: (Connection connection, Selector selector) -> void
62
62
 
@@ -72,9 +72,9 @@ module HTTPX
72
72
 
73
73
  def on_resolver_close: (Resolver::Resolver resolver, Selector selector) -> void
74
74
 
75
- def find_resolver_for: (Connection connection, Selector selector) -> (Resolver::Multi | Resolver::Resolver)
75
+ def find_resolver_for: (Connection connection, Selector selector) -> resolver
76
76
 
77
- def coalesce_connections: (Connection conn1, Connection conn2, Selector selector, bool from_pool) -> bool
77
+ def coalesce_connections: (Connection conn1, Connection conn2, Selector selector, bool from_pool) -> void
78
78
 
79
79
  def get_current_selector: () -> Selector?
80
80
  | () { () -> Selector } -> Selector
@@ -7,8 +7,6 @@ module HTTPX
7
7
  def read: (?int? length, ?string? output) -> String?
8
8
  end
9
9
 
10
- MULTIPART_VALUE_COND: ^(_Reader | record_multipart_value value) -> bool
11
-
12
10
  type multipart_value = string | Pathname | File | Tempfile | _Reader
13
11
 
14
12
  type record_multipart_value = { content_type: String, filename: String, body: multipart_value } |
@@ -22,6 +20,10 @@ module HTTPX
22
20
 
23
21
  def self?.multipart?: (form_nested_value | multipart_nested_value form_data) -> bool
24
22
 
23
+ def self?.multipart_value?: (multipart_nested_value value) -> bool
24
+
25
+ def self?.normalize_keys: [U] (_ToS key, _ToAry[untyped] | _ToHash[_ToS, untyped] | untyped value, ?_KeyNormalizer transcoder) { (String, ?untyped) -> U } -> U
26
+
25
27
  class Encoder
26
28
  @boundary: String
27
29
  @part_index: Integer
data/sig/transcoder.rbs CHANGED
@@ -3,8 +3,12 @@ module HTTPX
3
3
 
4
4
  type body_encoder = (Transcoder::_Encoder & _ToS) | (Transcoder::_Encoder & _Reader) | (Transcoder::_Encoder & _Each[String])
5
5
 
6
+ interface _KeyNormalizer
7
+ def normalize_keys: [U] (_ToS key, _ToAry[untyped] | _ToHash[_ToS, untyped] | untyped value, ?_KeyNormalizer transcoder) { (String, ?untyped) -> U } -> U
8
+ end
9
+
6
10
  module Transcoder
7
- def self?.normalize_keys: [U] (_ToS key, _ToAry[untyped] | _ToHash[_ToS, untyped] | untyped value, ?(^(untyped value) -> bool | nil) cond) { (String, ?untyped) -> U } -> U
11
+ def self?.normalize_keys: [U] (_ToS key, _ToAry[untyped] | _ToHash[_ToS, untyped] | untyped value, ?_KeyNormalizer transcoder) { (String, ?untyped) -> U } -> U
8
12
 
9
13
  def self?.normalize_query: (Hash[String, untyped] params, String name, String v, Integer depth) -> void
10
14
 
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.6.2
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tiago Cardoso
@@ -158,6 +158,8 @@ extra_rdoc_files:
158
158
  - doc/release_notes/1_6_0.md
159
159
  - doc/release_notes/1_6_1.md
160
160
  - doc/release_notes/1_6_2.md
161
+ - doc/release_notes/1_6_3.md
162
+ - doc/release_notes/1_7_0.md
161
163
  files:
162
164
  - LICENSE.txt
163
165
  - README.md
@@ -288,6 +290,8 @@ files:
288
290
  - doc/release_notes/1_6_0.md
289
291
  - doc/release_notes/1_6_1.md
290
292
  - doc/release_notes/1_6_2.md
293
+ - doc/release_notes/1_6_3.md
294
+ - doc/release_notes/1_7_0.md
291
295
  - lib/httpx.rb
292
296
  - lib/httpx/adapters/datadog.rb
293
297
  - lib/httpx/adapters/faraday.rb