httpx 1.5.1 → 1.6.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 (94) hide show
  1. checksums.yaml +4 -4
  2. data/doc/release_notes/1_6_0.md +50 -0
  3. data/lib/httpx/adapters/datadog.rb +23 -13
  4. data/lib/httpx/adapters/faraday.rb +14 -9
  5. data/lib/httpx/adapters/webmock.rb +1 -1
  6. data/lib/httpx/callbacks.rb +1 -1
  7. data/lib/httpx/connection/http1.rb +5 -6
  8. data/lib/httpx/connection/http2.rb +30 -12
  9. data/lib/httpx/connection.rb +17 -24
  10. data/lib/httpx/errors.rb +3 -1
  11. data/lib/httpx/io/ssl.rb +1 -4
  12. data/lib/httpx/io/tcp.rb +25 -16
  13. data/lib/httpx/io/unix.rb +4 -3
  14. data/lib/httpx/loggable.rb +4 -1
  15. data/lib/httpx/options.rb +252 -158
  16. data/lib/httpx/plugins/aws_sdk_authentication.rb +2 -0
  17. data/lib/httpx/plugins/aws_sigv4.rb +2 -0
  18. data/lib/httpx/plugins/callbacks.rb +13 -1
  19. data/lib/httpx/plugins/circuit_breaker.rb +2 -0
  20. data/lib/httpx/plugins/content_digest.rb +2 -0
  21. data/lib/httpx/plugins/cookies.rb +2 -2
  22. data/lib/httpx/plugins/digest_auth.rb +2 -0
  23. data/lib/httpx/plugins/expect.rb +2 -0
  24. data/lib/httpx/plugins/fiber_concurrency.rb +195 -0
  25. data/lib/httpx/plugins/follow_redirects.rb +2 -0
  26. data/lib/httpx/plugins/grpc.rb +2 -0
  27. data/lib/httpx/plugins/h2c.rb +26 -16
  28. data/lib/httpx/plugins/internal_telemetry.rb +0 -49
  29. data/lib/httpx/plugins/ntlm_auth.rb +2 -0
  30. data/lib/httpx/plugins/oauth.rb +2 -0
  31. data/lib/httpx/plugins/persistent.rb +27 -18
  32. data/lib/httpx/plugins/proxy/socks4.rb +1 -1
  33. data/lib/httpx/plugins/proxy/socks5.rb +1 -1
  34. data/lib/httpx/plugins/proxy/ssh.rb +2 -0
  35. data/lib/httpx/plugins/proxy.rb +61 -20
  36. data/lib/httpx/plugins/response_cache/file_store.rb +2 -2
  37. data/lib/httpx/plugins/response_cache.rb +2 -0
  38. data/lib/httpx/plugins/retries.rb +2 -0
  39. data/lib/httpx/plugins/ssrf_filter.rb +2 -2
  40. data/lib/httpx/plugins/stream_bidi.rb +3 -3
  41. data/lib/httpx/plugins/upgrade/h2.rb +11 -1
  42. data/lib/httpx/plugins/upgrade.rb +8 -0
  43. data/lib/httpx/pool.rb +15 -10
  44. data/lib/httpx/request/body.rb +8 -3
  45. data/lib/httpx/request.rb +22 -11
  46. data/lib/httpx/resolver/entry.rb +30 -0
  47. data/lib/httpx/resolver/https.rb +3 -1
  48. data/lib/httpx/resolver/multi.rb +5 -2
  49. data/lib/httpx/resolver/native.rb +15 -6
  50. data/lib/httpx/resolver/resolver.rb +3 -5
  51. data/lib/httpx/resolver/system.rb +1 -1
  52. data/lib/httpx/resolver.rb +34 -21
  53. data/lib/httpx/response/body.rb +1 -1
  54. data/lib/httpx/response/buffer.rb +13 -18
  55. data/lib/httpx/selector.rb +92 -34
  56. data/lib/httpx/session.rb +89 -30
  57. data/lib/httpx/session_extensions.rb +3 -2
  58. data/lib/httpx/transcoder/form.rb +1 -13
  59. data/lib/httpx/transcoder/multipart/mime_type_detector.rb +1 -1
  60. data/lib/httpx/transcoder/multipart.rb +14 -0
  61. data/lib/httpx/transcoder/utils/deflater.rb +1 -1
  62. data/lib/httpx/version.rb +1 -1
  63. data/sig/callbacks.rbs +1 -1
  64. data/sig/chainable.rbs +1 -0
  65. data/sig/connection/http1.rbs +2 -0
  66. data/sig/connection/http2.rbs +4 -0
  67. data/sig/connection.rbs +6 -6
  68. data/sig/errors.rbs +3 -1
  69. data/sig/io/ssl.rbs +1 -1
  70. data/sig/io/tcp.rbs +13 -7
  71. data/sig/io/udp.rbs +7 -2
  72. data/sig/io/unix.rbs +0 -1
  73. data/sig/io.rbs +0 -3
  74. data/sig/options.rbs +63 -10
  75. data/sig/plugins/fiber_concurrency.rbs +51 -0
  76. data/sig/plugins/h2c.rbs +5 -1
  77. data/sig/plugins/persistent.rbs +1 -1
  78. data/sig/plugins/proxy/socks4.rbs +1 -1
  79. data/sig/plugins/proxy/socks5.rbs +1 -1
  80. data/sig/plugins/proxy.rbs +5 -2
  81. data/sig/plugins/ssrf_filter.rbs +1 -1
  82. data/sig/plugins/stream_bidi.rbs +2 -2
  83. data/sig/request.rbs +4 -1
  84. data/sig/resolver/entry.rbs +13 -0
  85. data/sig/resolver/native.rbs +1 -0
  86. data/sig/resolver/resolver.rbs +2 -3
  87. data/sig/resolver/system.rbs +2 -2
  88. data/sig/resolver.rbs +10 -11
  89. data/sig/response.rbs +2 -2
  90. data/sig/selector.rbs +18 -10
  91. data/sig/session.rbs +4 -0
  92. data/sig/transcoder/form.rbs +3 -3
  93. data/sig/transcoder/multipart.rbs +9 -3
  94. metadata +9 -3
data/sig/io/udp.rbs CHANGED
@@ -2,9 +2,14 @@ module HTTPX
2
2
  class UDP
3
3
  include Loggable
4
4
 
5
+ @host: String
6
+ @port: Integer
7
+ @io: UDPSocket
8
+ @options: Options
9
+
5
10
  def initialize: (String ip, Integer port, Options options) -> void
6
11
 
7
- def to_io: () -> ::IO
12
+ def to_io: () -> IO
8
13
 
9
14
  def connect: () -> void
10
15
 
@@ -13,7 +18,7 @@ module HTTPX
13
18
  # :nocov:
14
19
  def close: () -> void
15
20
 
16
- def read: (Integer size, ?(Buffer | String) buffer) -> Integer?
21
+ def read: (Integer size, String buffer) -> Integer?
17
22
 
18
23
  def write: (Buffer buffer) -> Integer?
19
24
  end
data/sig/io/unix.rbs CHANGED
@@ -19,7 +19,6 @@ module HTTPX
19
19
 
20
20
  def connect: () -> void
21
21
 
22
- def expired?: () -> bool
23
22
  private
24
23
 
25
24
  def build_socket: () -> Socket
data/sig/io.rbs CHANGED
@@ -1,6 +1,3 @@
1
1
  module HTTPX
2
2
  type io_type = "udp" | "tcp" | "ssl" | "unix"
3
-
4
- module IO
5
- end
6
3
  end
data/sig/options.rbs CHANGED
@@ -13,7 +13,8 @@ module HTTPX
13
13
  KEEP_ALIVE_TIMEOUT: Integer
14
14
  SETTINGS_TIMEOUT: Integer
15
15
  CLOSE_HANDSHAKE_TIMEOUT: Integer
16
- SET_TEMPORARY_NAME: ^(Module mod, ?Symbol pl) -> void
16
+ SET_TEMPORARY_NAME: ^(Class klass, ?Symbol pl) -> void
17
+
17
18
  DEFAULT_OPTIONS: Hash[Symbol, untyped]
18
19
  REQUEST_BODY_IVARS: Array[Symbol]
19
20
 
@@ -22,6 +23,8 @@ module HTTPX
22
23
 
23
24
  def self.new: (?options) -> instance
24
25
 
26
+ attr_reader self.options_names: Array[Symbol]
27
+
25
28
  # headers
26
29
  attr_reader uri: URI?
27
30
 
@@ -53,7 +56,7 @@ module HTTPX
53
56
  attr_reader transport: io_type | nil
54
57
 
55
58
  # addresses
56
- attr_reader addresses: Array[ipaddr]?
59
+ attr_reader addresses: Array[Resolver::Entry]?
57
60
 
58
61
  # supported_compression_formats
59
62
  attr_reader supported_compression_formats: Array[String]
@@ -70,12 +73,17 @@ module HTTPX
70
73
  # base_path
71
74
  attr_reader base_path: String?
72
75
 
73
- # ssl
76
+ # classes
77
+ attr_reader resolver_native_class: singleton(Resolver::Native)
74
78
 
75
- # http2_settings
79
+ attr_reader resolver_system_class: singleton(Resolver::System)
76
80
 
81
+ attr_reader resolver_https_class: singleton(Resolver::HTTPS)
82
+
83
+ attr_reader http1_class: singleton(Connection::HTTP1)
84
+
85
+ attr_reader http2_class: singleton(Connection::HTTP2)
77
86
 
78
- # classes
79
87
  attr_reader connection_class: singleton(Connection)
80
88
 
81
89
  attr_reader pool_class: singleton(Pool)
@@ -92,7 +100,7 @@ module HTTPX
92
100
 
93
101
  attr_reader options_class: singleton(Options)
94
102
 
95
- attr_reader resolver_class: Symbol | Class
103
+ attr_reader resolver_class: Symbol | singleton(Resolver::Resolver)
96
104
 
97
105
  attr_reader ssl: Hash[Symbol, untyped]
98
106
 
@@ -136,13 +144,58 @@ module HTTPX
136
144
 
137
145
  private
138
146
 
139
- REQUEST_IVARS: Array[Symbol]
140
-
141
147
  def initialize: (?options options) -> void
142
148
 
143
- def do_initialize: (?options options) -> void
144
-
145
149
  def access_option: (Hash[Symbol, untyped] | Object | nil obj, Symbol k, Hash[Symbol, Symbol]? ivar_map) -> untyped
150
+
151
+ # integer
152
+ def option_max_concurrent_requests: (Numeric value) -> Numeric
153
+ def option_max_requests: (Numeric value) -> Numeric
154
+ def option_window_size: (Numeric value) -> Numeric
155
+ def option_buffer_size: (Numeric value) -> Numeric
156
+ def option_body_threshold_size: (Numeric value) -> Numeric
157
+ def option_debug_level: (Numeric value) -> Numeric
158
+
159
+ # to hash
160
+ def option_ssl: (_ToHash[Symbol, untyped] value) -> Hash[Symbol, untyped]
161
+ def option_http2_settings: (_ToHash[Symbol, untyped] value) -> Hash[Symbol, untyped]
162
+ def option_resolver_options: (_ToHash[Symbol, untyped] value) -> Hash[Symbol, untyped]
163
+ def option_pool_options: (_ToHash[Symbol, untyped] value) -> Hash[Symbol, untyped]
164
+
165
+ # no transform
166
+ def option_request_class: (singleton(Request) value) -> singleton(Request)
167
+ def option_response_class: (singleton(Response) value) -> singleton(Response)
168
+ def option_headers_class: (singleton(Headers) value) -> singleton(Headers)
169
+ def option_request_body_class: (singleton(Request::Body) value) -> singleton(Request::Body)
170
+ def option_response_body_class: (singleton(Response::Body) value) -> singleton(Response::Body)
171
+ def option_connection_class: (singleton(Connection) value) -> singleton(Connection)
172
+ def option_options_class: (singleton(Options) value) -> singleton(Options)
173
+ def option_pool_class: (singleton(Pool) value) -> singleton(Pool)
174
+ def option_resolver_class: (Symbol | singleton(Resolver::Resolver) value) -> (Symbol | singleton(Resolver::Resolver))
175
+ def option_io: (io_option value) -> io_option
176
+ def option_fallback_protocol: (String value) -> String
177
+ def option_debug: (_IOLogger value) -> _IOLogger
178
+ def option_debug_redact: (bool value) -> bool
179
+ def option_compress_request_body: (bool value) -> bool
180
+ def option_decompress_response_body: (bool value) -> bool
181
+ def option_persistent: (bool value) -> bool
182
+ def option_close_on_fork: (bool value) -> bool
183
+
184
+ def option_origin: (http_uri | String value) -> http_uri
185
+
186
+ def option_base_path: (_ToStr value) -> String
187
+
188
+ def option_headers: (headers_input | Headers value) -> Headers
189
+
190
+ def option_timeout: (_ToHash[timeout_type, Numeric?]) -> timeout
191
+
192
+ def option_supported_compression_formats: (_ToS | _ToAry[_ToS] value) -> Array[String]
193
+
194
+ def option_transport: (_ToS value) -> String
195
+
196
+ def option_addresses: (ipaddr | _ToAry[ipaddr] value) -> Array[ipaddr]
197
+
198
+ def option_ip_families: (Integer | _ToAry[Integer] value) -> Array[Integer]
146
199
  end
147
200
 
148
201
  type options = Options | Hash[Symbol, untyped]
@@ -0,0 +1,51 @@
1
+ module HTTPX
2
+ module Plugins
3
+ module FiberConcurrency
4
+ module InstanceMethods
5
+ end
6
+
7
+ module RequestMethods
8
+ attr_reader context: Fiber?
9
+
10
+ def set_context!: () -> void
11
+
12
+ def current_context?: () -> bool
13
+ end
14
+
15
+ module ConnectionMethods
16
+
17
+ def current_context?: () -> bool
18
+
19
+ def send: (request request) -> void
20
+ end
21
+
22
+ module HTTP1Methods
23
+ end
24
+
25
+ module HTTP2Methods
26
+ @contexts: Hash[Fiber, Set[Request]]
27
+
28
+ private
29
+
30
+ def add_to_context: (request request) -> void
31
+
32
+ def clear_from_context: (request request) -> void
33
+ end
34
+
35
+ module NativeResolverMethods
36
+ end
37
+
38
+ module SystemResolverMethods
39
+ end
40
+
41
+ module FiberConcurrencyH2C
42
+ module HTTP2Methods
43
+ end
44
+ end
45
+
46
+ type request = Request & RequestMethods
47
+ end
48
+
49
+ type sessionFiberConcurrency = Session & FiberConcurrency::InstanceMethods
50
+ end
51
+ end
data/sig/plugins/h2c.rbs CHANGED
@@ -7,7 +7,11 @@ module HTTPX
7
7
  def self.configure: (singleton(Session)) -> void
8
8
  def self.call: (Connection, Request, response) -> void
9
9
 
10
- class H2CParser < Connection::HTTP2
10
+ interface _H2COptions
11
+ def h2c_class: () -> (singleton(Connection::HTTP2) & H2CParser)
12
+ end
13
+
14
+ module H2CParser
11
15
  def upgrade: (Request, Response) -> void
12
16
  end
13
17
 
@@ -9,6 +9,6 @@ module HTTPX
9
9
  end
10
10
  end
11
11
 
12
- type sessionPersistent = Session & Persistent::InstanceMethods
12
+ type sessionPersistent = sessionFiberConcurrency & Persistent::InstanceMethods
13
13
  end
14
14
  end
@@ -1,5 +1,5 @@
1
1
  module HTTPX
2
- class Socks4Error < HTTPProxyError
2
+ class Socks4Error < ProxyError
3
3
  end
4
4
 
5
5
  module Plugins
@@ -1,5 +1,5 @@
1
1
  module HTTPX
2
- class Socks5Error < HTTPProxyError
2
+ class Socks5Error < ProxyError
3
3
  end
4
4
 
5
5
  module Plugins
@@ -1,8 +1,9 @@
1
1
  module HTTPX
2
- class HTTPProxyError < ConnectionError
2
+ class ProxyError < ConnectionError
3
3
  end
4
4
 
5
5
  class ProxySSL < SSL
6
+ attr_reader proxy_io: TCP | SSL
6
7
  end
7
8
 
8
9
  module Plugins
@@ -11,7 +12,9 @@ module HTTPX
11
12
  end
12
13
 
13
14
  module Proxy
14
- Error: singleton(HTTPProxyError)
15
+ class ProxyConnectionError < ProxyError
16
+ end
17
+
15
18
  PROXY_ERRORS: Array[singleton(StandardError)]
16
19
 
17
20
  class Parameters
@@ -8,7 +8,7 @@ module HTTPX
8
8
 
9
9
  IPV6_BLACKLIST: Array[[IPAddr, IPAddr]]
10
10
 
11
- def self?.unsafe_ip_address?: (IPAddr) -> bool
11
+ def self?.unsafe_ip_address?: (Resolver::Entry ipaddr) -> bool
12
12
 
13
13
  interface _Options
14
14
  def allowed_schemes: () -> Array[String]
@@ -25,8 +25,8 @@ module HTTPX
25
25
 
26
26
  class Signal
27
27
  @closed: bool
28
- @pipe_read: ::IO
29
- @pipe_write: ::IO
28
+ @pipe_read: IO
29
+ @pipe_write: IO
30
30
 
31
31
  include _Selectable
32
32
 
data/sig/request.rbs CHANGED
@@ -1,6 +1,7 @@
1
1
  module HTTPX
2
2
  class Request
3
3
  extend Forwardable
4
+ include Loggable
4
5
  include Callbacks
5
6
 
6
7
  METHODS: Array[Symbol]
@@ -16,7 +17,7 @@ module HTTPX
16
17
  attr_reader drain_error: StandardError?
17
18
  attr_reader active_timeouts: Array[Symbol]
18
19
 
19
- attr_accessor peer_address: ipaddr?
20
+ attr_accessor peer_address: (String | IPAddr)?
20
21
 
21
22
  attr_writer persistent: bool
22
23
 
@@ -29,6 +30,8 @@ module HTTPX
29
30
 
30
31
  def initialize: (Symbol | String verb, generic_uri uri, Options options, ?request_params params) -> untyped
31
32
 
33
+ def complete!: (?response response) -> void
34
+
32
35
  def ping?: () -> bool
33
36
 
34
37
  def ping!: () -> void
@@ -0,0 +1,13 @@
1
+ module HTTPX
2
+ class Resolver::Entry
3
+ attr_reader address: IPAddr | String
4
+
5
+ @expires_in: Numeric
6
+
7
+ def initialize: (IPAddr | _ToS address, ?Numeric expires_in, ?rescue_on_convert: boolish) -> void
8
+
9
+ def expired?: () -> bool
10
+
11
+ def self.convert: (IPAddr | _ToS address) -> Resolver::Entry
12
+ end
13
+ end
@@ -23,6 +23,7 @@ module HTTPX
23
23
  @large_packet: Buffer?
24
24
  @io: UDP | TCP
25
25
  @name: String?
26
+ @timer: Timers::Timer?
26
27
 
27
28
  attr_reader state: Symbol
28
29
 
@@ -22,7 +22,6 @@ module HTTPX
22
22
 
23
23
  @record_type: singleton(Resolv::DNS::Resource)
24
24
  @resolver_options: Hash[Symbol, untyped]
25
- @system_resolver: Resolv::Hosts
26
25
  @connections: Array[Connection]
27
26
 
28
27
  def close: () -> void
@@ -35,7 +34,7 @@ module HTTPX
35
34
 
36
35
  def each_connection: () { (Connection connection) -> void } -> void
37
36
 
38
- def emit_addresses: (Connection connection, ip_family family, Array[IPAddr], ?bool early_resolve) -> void
37
+ def emit_addresses: (Connection connection, ip_family family, Array[ipaddr], ?bool early_resolve) -> void
39
38
 
40
39
  def self.multi?: () -> bool
41
40
 
@@ -43,7 +42,7 @@ module HTTPX
43
42
 
44
43
  def resolve: (?Connection connection, ?String hostname) -> void
45
44
 
46
- def emit_resolved_connection: (Connection connection, Array[IPAddr] addresses, bool early_resolve) -> void
45
+ def emit_resolved_connection: (Connection connection, Array[ipaddr] addresses, bool early_resolve) -> void
47
46
 
48
47
  def initialize: (ip_family family, Options options) -> void
49
48
 
@@ -11,8 +11,8 @@ module HTTPX
11
11
  @queries: Array[[ip_family, Connection]]
12
12
  @ips: Array[[ip_family, Connection, (Array[Addrinfo] | StandardError)]]
13
13
  @pipe_mutex: Thread::Mutex
14
- @pipe_read: ::IO
15
- @pipe_write: ::IO
14
+ @pipe_read: IO
15
+ @pipe_write: IO
16
16
 
17
17
  attr_reader state: Symbol
18
18
 
data/sig/resolver.rbs CHANGED
@@ -1,5 +1,5 @@
1
1
  module HTTPX
2
- type ipaddr = IPAddr | String
2
+ type ipaddr = String | IPAddr | Resolv::IPv4 | Resolver::Entry
3
3
 
4
4
  module Resolver
5
5
  type dns_resource = singleton(Resolv::DNS::Resource)
@@ -13,26 +13,25 @@ module HTTPX
13
13
  self.@lookups: Hash[String, Array[dns_result]]
14
14
  self.@identifier_mutex: Thread::Mutex
15
15
  self.@identifier: Integer
16
- self.@system_resolver: Resolv::Hosts
16
+ self.@hosts_resolver: Resolv::Hosts
17
17
 
18
18
  type dns_decoding_response = [:ok, Array[dns_result]] | [:decode_error, Resolv::DNS::DecodeError] | [:dns_error, Integer] | Symbol
19
19
 
20
- def self?.nolookup_resolve: (String hostname) -> Array[IPAddr]?
20
+ def self?.nolookup_resolve: (String hostname) -> Array[Entry]?
21
21
 
22
- def self?.ip_resolve: (String hostname) -> Array[IPAddr]?
22
+ def self?.ip_resolve: (String hostname) -> Array[Entry]?
23
23
 
24
- def self?.system_resolve: (String hostname) -> Array[IPAddr]?
24
+ def self?.hosts_resolve: (String hostname) -> Array[Entry]?
25
25
 
26
- def self?.resolver_for: (:native resolver_type) -> singleton(Native) |
27
- (:system resolver_type) -> singleton(System) |
28
- (:https resolver_type) -> singleton(HTTPS) |
29
- [U] (U resolver_type) -> U
26
+ def self?.resolver_for: (Symbol | singleton(Resolver) resolver_type, Options options) -> singleton(Resolver)
30
27
 
31
- def self?.cached_lookup: (String hostname) -> Array[IPAddr]?
28
+ def self?.cached_lookup: (String hostname) -> Array[Entry]?
32
29
 
33
30
  def self?.cached_lookup_set: (String hostname, ip_family family, Array[dns_result] addresses) -> void
34
31
 
35
- def self?.lookup: (String hostname, Hash[String, Array[dns_result]] lookups, Numeric ttl) -> Array[IPAddr]?
32
+ def self?.cached_lookup_evict: (String hostname, _ToS ip) -> void
33
+
34
+ def self?.lookup: (String hostname, Hash[String, Array[dns_result]] lookups, Numeric ttl) -> Array[Entry]?
36
35
 
37
36
  def self?.generate_id: () -> Integer
38
37
 
data/sig/response.rbs CHANGED
@@ -35,7 +35,7 @@ module HTTPX
35
35
 
36
36
  def uri: () -> URI::Generic
37
37
 
38
- def peer_address: () -> ipaddr?
38
+ def peer_address: () -> (String | IPAddr)?
39
39
 
40
40
  def merge_headers: (_Each[[String, headers_value]]) -> void
41
41
 
@@ -90,7 +90,7 @@ module HTTPX
90
90
 
91
91
  def uri: () -> URI::Generic
92
92
 
93
- def peer_address: () -> ipaddr?
93
+ def peer_address: () -> (String | IPAddr)?
94
94
 
95
95
  def close: () -> void
96
96
 
data/sig/selector.rbs CHANGED
@@ -2,7 +2,7 @@ module HTTPX
2
2
  interface _Selectable
3
3
  def state: () -> Symbol
4
4
 
5
- def to_io: () -> ::IO
5
+ def to_io: () -> IO
6
6
 
7
7
  def call: () -> void
8
8
 
@@ -14,14 +14,20 @@ module HTTPX
14
14
  end
15
15
 
16
16
  class Selector
17
- include _Each[_Selectable]
17
+ type selectable = Resolver::Resolver | Connection | (Object & _Selectable)
18
18
 
19
- READABLE: Array[Symbol]
20
- WRITABLE: Array[Symbol]
19
+ type io_select_selectable = (selectable | Array[selectable])?
20
+
21
+ include _Each[selectable]
22
+
23
+ extend Forwardable
24
+
25
+ READABLE: Array[io_interests]
26
+ WRITABLE: Array[io_interests]
21
27
 
22
28
  @timers: Timers
23
29
 
24
- @selectables: Array[_Selectable]
30
+ @selectables: Array[selectable]
25
31
  @is_timer_interval: bool
26
32
 
27
33
  def next_tick: () -> void
@@ -39,21 +45,23 @@ module HTTPX
39
45
 
40
46
  def empty?: () -> bool
41
47
 
42
- def register: (_Selectable io) -> void
48
+ def register: (selectable io) -> void
43
49
 
44
- def deregister: (_Selectable io) -> _Selectable?
50
+ def deregister: (selectable io) -> selectable?
45
51
 
46
52
  private
47
53
 
48
54
  def initialize: () -> void
49
55
 
50
- def select: (Numeric? interval) { (_Selectable) -> void } -> void
56
+ def select: (Numeric? interval) { (selectable) -> void } -> void
51
57
 
52
- def select_many: (Numeric? interval) { (_Selectable) -> void } -> void
58
+ def select_many: (io_select_selectable r, io_select_selectable w, Numeric? interval) { (selectable) -> void } -> void
53
59
 
54
- def select_one: (Numeric? interval) { (_Selectable) -> void } -> void
60
+ def select_one: (selectable io, io_interests interests, Numeric? interval) { (selectable) -> void } -> void
55
61
 
56
62
  def next_timeout: () -> Numeric?
63
+
64
+ def rw_wait: (io_select_selectable IO, Numeric? interval) -> untyped?
57
65
  end
58
66
 
59
67
  type io_interests = :r | :w | :rw
data/sig/session.rbs CHANGED
@@ -40,6 +40,8 @@ module HTTPX
40
40
  def initialize: (?options) { (self) -> void } -> void
41
41
  | (?options) -> void
42
42
 
43
+ def selector_close: (Selector close) -> void
44
+
43
45
  def deactivate: (Selector selector) -> void
44
46
 
45
47
  def on_promise: (untyped, untyped) -> void
@@ -81,6 +83,8 @@ module HTTPX
81
83
 
82
84
  def selector_store: () -> Hash[instance, Selector]
83
85
 
86
+ def thread_selector_store: (Thread th) -> Hash[instance, Selector]?
87
+
84
88
  attr_reader self.default_options: Options
85
89
  self.@plugins: Array[Module]
86
90
 
@@ -3,14 +3,14 @@ module HTTPX::Transcoder
3
3
 
4
4
  type form_nested_value = form_value | _ToAry[form_value] | _ToHash[string, form_value]
5
5
 
6
- type urlencoded_input = Enumerable[[_ToS, form_nested_value | Multipart::multipart_nested_value]]
6
+ type urlencoded_input = Enumerable[[_ToS, form_nested_value]]
7
7
 
8
8
  module Form
9
9
  PARAM_DEPTH_LIMIT: Integer
10
10
 
11
- def self?.encode: (urlencoded_input form) -> (Encoder | Multipart::Encoder)
11
+ def self?.encode: (urlencoded_input form) -> Encoder
12
+
12
13
  def self?.decode: (HTTPX::Response response) -> _Decoder
13
- def self?.multipart?: (form_nested_value | Multipart::multipart_nested_value data) -> bool
14
14
 
15
15
  class Encoder
16
16
  extend Forwardable
@@ -16,6 +16,12 @@ module HTTPX
16
16
 
17
17
  type multipart_nested_value = multipart_value | _ToAry[multipart_value] | _ToHash[string, multipart_value]
18
18
 
19
+ type multipart_input = Enumerable[[_ToS, Multipart::multipart_nested_value]]
20
+
21
+ def self?.encode: (multipart_input form_data) -> Multipart::Encoder
22
+
23
+ def self?.multipart?: (form_nested_value | multipart_nested_value form_data) -> bool
24
+
19
25
  class Encoder
20
26
  @boundary: String
21
27
  @part_index: Integer
@@ -36,9 +42,9 @@ module HTTPX
36
42
 
37
43
  private
38
44
 
39
- def to_parts: (Enumerable[[Symbol | string, multipart_nested_value]] multipart_data) -> Array[_Reader]
45
+ def to_parts: (multipart_input multipart_data) -> Array[_Reader]
40
46
 
41
- def initialize: (Enumerable[[Symbol | string, multipart_nested_value]] multipart_data) -> untyped
47
+ def initialize: (multipart_input multipart_data) -> untyped
42
48
 
43
49
  def header_part: (String key, String content_type, String? filename) -> StringIO
44
50
 
@@ -90,7 +96,7 @@ module HTTPX
90
96
  module MimeTypeDetector
91
97
  DEFAULT_MIMETYPE: String
92
98
 
93
- def self?.call: (::IO | Tempfile file, String filename) -> String?
99
+ def self?.call: (IO | Tempfile file, String filename) -> String?
94
100
  end
95
101
  end
96
102
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: httpx
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tiago Cardoso
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-06-09 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: http-2
@@ -155,6 +155,7 @@ extra_rdoc_files:
155
155
  - doc/release_notes/1_4_4.md
156
156
  - doc/release_notes/1_5_0.md
157
157
  - doc/release_notes/1_5_1.md
158
+ - doc/release_notes/1_6_0.md
158
159
  files:
159
160
  - LICENSE.txt
160
161
  - README.md
@@ -282,6 +283,7 @@ files:
282
283
  - doc/release_notes/1_4_4.md
283
284
  - doc/release_notes/1_5_0.md
284
285
  - doc/release_notes/1_5_1.md
286
+ - doc/release_notes/1_6_0.md
285
287
  - lib/httpx.rb
286
288
  - lib/httpx/adapters/datadog.rb
287
289
  - lib/httpx/adapters/faraday.rb
@@ -327,6 +329,7 @@ files:
327
329
  - lib/httpx/plugins/cookies/set_cookie_parser.rb
328
330
  - lib/httpx/plugins/digest_auth.rb
329
331
  - lib/httpx/plugins/expect.rb
332
+ - lib/httpx/plugins/fiber_concurrency.rb
330
333
  - lib/httpx/plugins/follow_redirects.rb
331
334
  - lib/httpx/plugins/grpc.rb
332
335
  - lib/httpx/plugins/grpc/call.rb
@@ -362,6 +365,7 @@ files:
362
365
  - lib/httpx/request.rb
363
366
  - lib/httpx/request/body.rb
364
367
  - lib/httpx/resolver.rb
368
+ - lib/httpx/resolver/entry.rb
365
369
  - lib/httpx/resolver/https.rb
366
370
  - lib/httpx/resolver/multi.rb
367
371
  - lib/httpx/resolver/native.rb
@@ -428,6 +432,7 @@ files:
428
432
  - sig/plugins/cookies/set_cookie_parser.rbs
429
433
  - sig/plugins/digest_auth.rbs
430
434
  - sig/plugins/expect.rbs
435
+ - sig/plugins/fiber_concurrency.rbs
431
436
  - sig/plugins/follow_redirects.rbs
432
437
  - sig/plugins/grpc.rbs
433
438
  - sig/plugins/grpc/call.rbs
@@ -461,6 +466,7 @@ files:
461
466
  - sig/request.rbs
462
467
  - sig/request/body.rbs
463
468
  - sig/resolver.rbs
469
+ - sig/resolver/entry.rbs
464
470
  - sig/resolver/https.rbs
465
471
  - sig/resolver/multi.rbs
466
472
  - sig/resolver/native.rbs
@@ -507,7 +513,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
507
513
  - !ruby/object:Gem::Version
508
514
  version: '0'
509
515
  requirements: []
510
- rubygems_version: 3.6.2
516
+ rubygems_version: 3.6.9
511
517
  specification_version: 4
512
518
  summary: HTTPX, to the future, and beyond
513
519
  test_files: []