httpx 1.8.4 → 1.9.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.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/doc/release_notes/1_8_1.md +1 -1
  3. data/doc/release_notes/1_8_2.md +4 -4
  4. data/doc/release_notes/1_8_3.md +3 -5
  5. data/doc/release_notes/1_8_4.md +1 -1
  6. data/doc/release_notes/1_9_0.md +75 -0
  7. data/doc/release_notes/1_9_1.md +32 -0
  8. data/lib/httpx/adapters/faraday.rb +1 -1
  9. data/lib/httpx/adapters/webmock.rb +15 -2
  10. data/lib/httpx/altsvc.rb +29 -15
  11. data/lib/httpx/chainable.rb +4 -1
  12. data/lib/httpx/connection/http1.rb +34 -35
  13. data/lib/httpx/connection/http2.rb +146 -33
  14. data/lib/httpx/connection.rb +282 -162
  15. data/lib/httpx/headers.rb +2 -2
  16. data/lib/httpx/io/tcp.rb +42 -21
  17. data/lib/httpx/options.rb +86 -35
  18. data/lib/httpx/parser/http1.rb +3 -6
  19. data/lib/httpx/plugins/auth/digest.rb +1 -2
  20. data/lib/httpx/plugins/auth.rb +11 -2
  21. data/lib/httpx/plugins/aws_sdk_authentication.rb +7 -3
  22. data/lib/httpx/plugins/aws_sigv4.rb +1 -1
  23. data/lib/httpx/plugins/basic_auth.rb +2 -0
  24. data/lib/httpx/plugins/cache.rb +1 -1
  25. data/lib/httpx/plugins/callbacks.rb +8 -6
  26. data/lib/httpx/plugins/circuit_breaker.rb +1 -0
  27. data/lib/httpx/plugins/content_digest.rb +3 -5
  28. data/lib/httpx/plugins/digest_auth.rb +2 -0
  29. data/lib/httpx/plugins/expect.rb +10 -1
  30. data/lib/httpx/plugins/fiber_concurrency.rb +59 -16
  31. data/lib/httpx/plugins/follow_redirects.rb +1 -1
  32. data/lib/httpx/plugins/grpc.rb +21 -0
  33. data/lib/httpx/plugins/h2c.rb +12 -11
  34. data/lib/httpx/plugins/hedging.rb +284 -0
  35. data/lib/httpx/plugins/ntlm_auth.rb +5 -3
  36. data/lib/httpx/plugins/ntlm_v2_auth.rb +5 -3
  37. data/lib/httpx/plugins/oauth.rb +2 -2
  38. data/lib/httpx/plugins/proxy/http.rb +67 -26
  39. data/lib/httpx/plugins/proxy/socks5.rb +4 -4
  40. data/lib/httpx/plugins/proxy/ssh.rb +30 -11
  41. data/lib/httpx/plugins/proxy.rb +68 -54
  42. data/lib/httpx/plugins/push_promise.rb +4 -2
  43. data/lib/httpx/plugins/query.rb +1 -0
  44. data/lib/httpx/plugins/retries.rb +2 -2
  45. data/lib/httpx/plugins/server_sent_events.rb +1 -0
  46. data/lib/httpx/plugins/ssrf_filter.rb +1 -1
  47. data/lib/httpx/plugins/stream.rb +12 -10
  48. data/lib/httpx/plugins/stream_bidi.rb +4 -0
  49. data/lib/httpx/plugins/tracing.rb +99 -11
  50. data/lib/httpx/plugins/upgrade/h2.rb +3 -3
  51. data/lib/httpx/plugins/upgrade.rb +2 -0
  52. data/lib/httpx/plugins/webdav.rb +8 -0
  53. data/lib/httpx/request/body.rb +2 -1
  54. data/lib/httpx/request.rb +6 -6
  55. data/lib/httpx/resolver/https.rb +3 -2
  56. data/lib/httpx/resolver/native.rb +19 -9
  57. data/lib/httpx/resolver/resolver.rb +2 -2
  58. data/lib/httpx/resolver/system.rb +4 -0
  59. data/lib/httpx/resolver.rb +10 -6
  60. data/lib/httpx/response.rb +19 -7
  61. data/lib/httpx/selector.rb +111 -10
  62. data/lib/httpx/session.rb +36 -10
  63. data/lib/httpx/transcoder/json.rb +1 -1
  64. data/lib/httpx/version.rb +1 -1
  65. data/lib/httpx.rb +1 -0
  66. data/sig/altsvc.rbs +3 -3
  67. data/sig/callbacks.rbs +1 -0
  68. data/sig/chainable.rbs +3 -1
  69. data/sig/connection/http1.rbs +4 -2
  70. data/sig/connection/http2.rbs +23 -17
  71. data/sig/connection.rbs +29 -7
  72. data/sig/headers.rbs +1 -1
  73. data/sig/httpx.rbs +2 -0
  74. data/sig/io/tcp.rbs +5 -0
  75. data/sig/options.rbs +43 -12
  76. data/sig/parser/http1.rbs +1 -1
  77. data/sig/plugins/auth/digest.rbs +0 -1
  78. data/sig/plugins/auth.rbs +12 -5
  79. data/sig/plugins/expect.rbs +6 -0
  80. data/sig/plugins/fiber_concurrency.rbs +10 -1
  81. data/sig/plugins/hedging.rbs +44 -0
  82. data/sig/plugins/proxy/http.rbs +9 -2
  83. data/sig/plugins/proxy.rbs +3 -2
  84. data/sig/plugins/retries.rbs +2 -2
  85. data/sig/plugins/stream_bidi.rbs +0 -2
  86. data/sig/plugins/tracing.rbs +22 -5
  87. data/sig/request/body.rbs +1 -1
  88. data/sig/resolver/entry.rbs +2 -2
  89. data/sig/resolver/https.rbs +2 -0
  90. data/sig/resolver/native.rbs +3 -0
  91. data/sig/resolver/resolver.rbs +1 -1
  92. data/sig/resolver/system.rbs +2 -0
  93. data/sig/resolver.rbs +1 -1
  94. data/sig/response.rbs +1 -2
  95. data/sig/selector.rbs +17 -3
  96. data/sig/session.rbs +8 -6
  97. metadata +7 -1
data/sig/io/tcp.rbs CHANGED
@@ -25,6 +25,7 @@ module HTTPX
25
25
  @keep_open: bool
26
26
 
27
27
  @ip_index: Integer
28
+ @attempt_started_at: Float?
28
29
 
29
30
  # TODO: lift when https://github.com/ruby/rbs/issues/1497 fixed
30
31
  def initialize: (URI::Generic origin, Array[Resolver::Entry]? addresses, Options options) ?{ (instance) -> void } -> void
@@ -33,6 +34,10 @@ module HTTPX
33
34
 
34
35
  def addresses?: () -> bool
35
36
 
37
+ def connect_attempt_time_left: () -> Float?
38
+
39
+ def next_address!: (StandardError e) -> void
40
+
36
41
  def to_io: () -> IO
37
42
 
38
43
  def protocol: () -> String
data/sig/options.rbs CHANGED
@@ -10,9 +10,6 @@ module HTTPX
10
10
  CONNECT_TIMEOUT: Integer
11
11
  READ_TIMEOUT: Integer
12
12
  WRITE_TIMEOUT: Integer
13
- REQUEST_TIMEOUT: Integer
14
- TOTAL_REQUEST_TIMEOUT: Integer
15
- OPERATION_TIMEOUT: Integer
16
13
  KEEP_ALIVE_TIMEOUT: Integer
17
14
  PING_TIMEOUT: Integer
18
15
  SETTINGS_TIMEOUT: Integer
@@ -26,22 +23,21 @@ module HTTPX
26
23
  USER_AGENT: String
27
24
 
28
25
  type timeout_type = :connect_timeout | :settings_timeout | :close_handshake_timeout | :operation_timeout | :keep_alive_timeout | :read_timeout | :write_timeout | :total_request_timeout | :request_timeout | :ping_timeout
29
- type timeout = Hash[timeout_type, interval?]
30
26
  type redact_value = :headers | :body | bool
31
27
  type resolver_cache_option = :memory | :file | (Object & Resolver::_Cache)
32
28
 
33
29
  def self.new: (?options) -> instance
34
30
 
35
- attr_reader self.options_names: Array[Symbol]
31
+ attr_reader self.options_names: Set[Symbol]
36
32
 
37
33
  # headers
38
34
  attr_reader uri: URI?
39
35
 
40
36
  # headers
41
- attr_reader headers: headers?
37
+ attr_reader headers: headers
42
38
 
43
39
  # timeout
44
- attr_reader timeout: timeout
40
+ attr_reader timeout: Timeouts
45
41
 
46
42
  # http2_settings
47
43
  attr_reader http2_settings: Hash[Symbol, Integer | bool]
@@ -74,7 +70,7 @@ module HTTPX
74
70
  attr_reader transport: io_type | nil
75
71
 
76
72
  # addresses
77
- attr_reader addresses: Array[Resolver::Entry]?
73
+ attr_reader addresses: (Hash[String, Array[Resolver::Entry]] | Array[Resolver::Entry])?
78
74
 
79
75
  # supported_compression_formats
80
76
  attr_reader supported_compression_formats: Array[String]
@@ -174,8 +170,6 @@ module HTTPX
174
170
 
175
171
  def do_initialize: () -> void
176
172
 
177
- def access_option: (Hash[Symbol, untyped] | Object | nil obj, Symbol k, Hash[Symbol, Symbol]? ivar_map) -> untyped
178
-
179
173
  # integer
180
174
  def option_max_concurrent_requests: (int value) -> maybe_unbounded
181
175
  def option_max_requests: (int value) -> maybe_unbounded
@@ -217,15 +211,52 @@ module HTTPX
217
211
 
218
212
  def option_headers: (headers_input | Headers value) -> Headers
219
213
 
220
- def option_timeout: (_ToHash[timeout_type, interval?]) -> timeout
214
+ def option_timeout: (Timeouts | _ToHash[timeout_type, interval?]) -> Timeouts
221
215
 
222
216
  def option_supported_compression_formats: (_ToS | _ToAry[_ToS] value) -> Array[String]
223
217
 
224
218
  def option_transport: (_ToS value) -> String
225
219
 
226
- def option_addresses: (ipaddr | _ToAry[ipaddr] value) -> Array[ipaddr]
220
+ def option_addresses: (ipaddr | _ToAry[ipaddr] value) -> Array[Resolver::Entry]
221
+ | (Hash[String, _ToAry[ipaddr]] value) -> Hash[String, Array[Resolver::Entry]]
227
222
 
228
223
  def option_ip_families: (ip_family | _ToAry[ip_family] value) -> Array[ip_family]
224
+
225
+ class Timeouts
226
+ attr_reader connect_timeout: interval?
227
+ attr_reader settings_timeout: interval?
228
+ attr_reader read_timeout: interval?
229
+ attr_reader write_timeout: interval?
230
+ attr_reader request_timeout: interval?
231
+ attr_reader total_request_timeout: interval?
232
+ attr_reader operation_timeout: interval?
233
+ attr_reader close_handshake_timeout: interval
234
+ attr_reader keep_alive_timeout: interval
235
+ attr_reader ping_timeout: interval
236
+
237
+ def initialize: (
238
+ ?connect_timeout: interval?,
239
+ ?settings_timeout: interval?,
240
+ ?read_timeout: interval?,
241
+ ?write_timeout: interval?,
242
+ ?request_timeout: interval?,
243
+ ?total_request_timeout: interval?,
244
+ ?operation_timeout: interval?,
245
+ ?close_handshake_timeout: interval?,
246
+ ?keep_alive_timeout: interval?,
247
+ ?ping_timeout: interval?
248
+ ) -> void
249
+
250
+ def merge: (Timeouts | Hash[Symbol, interval?]) -> Timeouts
251
+
252
+ def []: (Symbol) -> interval?
253
+
254
+ def to_h: () -> Hash[Symbol, interval?]
255
+
256
+ private
257
+
258
+ def deadline_timeouts?: () -> boolish
259
+ end
229
260
  end
230
261
 
231
262
  type options = Options | Hash[Symbol, untyped]
data/sig/parser/http1.rbs CHANGED
@@ -18,7 +18,7 @@ module HTTPX
18
18
  VERSIONS: Array[String]
19
19
 
20
20
  attr_reader status_code: Integer
21
- attr_reader http_version: [Integer, Integer]
21
+ attr_reader http_version: String
22
22
  attr_reader headers: parsed_headers
23
23
 
24
24
  @observer: _HTTP1Events
@@ -8,7 +8,6 @@ module HTTPX
8
8
  @user: String
9
9
  @password: String
10
10
  @hashed: bool
11
- @nonce: Integer
12
11
 
13
12
  def can_authenticate?: (String? authenticate) -> boolish
14
13
 
data/sig/plugins/auth.rbs CHANGED
@@ -1,14 +1,14 @@
1
1
  module HTTPX
2
2
  module Plugins
3
3
  module Auth
4
- type auth_header_value_type = String | ^(?Request request, ?bool should_regenerate) -> string
4
+ type auth_header_value_type = String | ^(?requestAuth request, ?bool should_regenerate) -> string
5
5
 
6
6
  interface _AuthOptions
7
7
  def auth_header_value: () -> auth_header_value_type?
8
8
 
9
9
  def auth_header_type: () -> String?
10
10
 
11
- def auth_header_expires_at: () -> (^(Request request) -> _ToF?)?
11
+ def auth_header_expires_at: () -> (^(requestAuth request) -> _ToF?)?
12
12
 
13
13
  def auth_header_expires_in: () -> Float?
14
14
  end
@@ -17,10 +17,11 @@ module HTTPX
17
17
  @auth_header_value: String?
18
18
  @auth_header_value_mtx: Thread::Mutex
19
19
  @skip_auth_header_value: bool
20
+ @auth_header_expires_at: interval?
20
21
 
21
- def authorization: (?string token, ?auth_header_type: string) ?{ (?Request, ?bool) -> string } -> instance
22
+ def authorization: (?string token, ?auth_header_type: string) ?{ (?requestAuth, ?bool) -> string } -> instance
22
23
 
23
- def bearer_auth: (?string token) ?{ (Request) -> string } -> instance
24
+ def bearer_auth: (?string token) ?{ (requestAuth) -> string } -> instance
24
25
 
25
26
  def skip_auth_header: [T] { () -> T } -> T
26
27
 
@@ -28,7 +29,11 @@ module HTTPX
28
29
 
29
30
  private
30
31
 
31
- def generate_auth_token: (Request & RequestMethods request, bool should_regenerate) -> String?
32
+ def generate_auth_token: (requestAuth request, bool should_regenerate) -> String?
33
+
34
+ def try_invalidate_auth_header_value: () -> void
35
+
36
+ def set_auth_header_expires_at: (requestAuth request) -> void
32
37
 
33
38
  def dynamic_auth_token?: (auth_header_value_type auth_header_value) -> boolish
34
39
  end
@@ -52,6 +57,8 @@ module HTTPX
52
57
  def auth_error?: (response response, Options options) -> boolish
53
58
  end
54
59
  end
60
+
61
+ type requestAuth = Request & RequestMethods
55
62
  end
56
63
 
57
64
  type sessionAuth = Session & Auth::InstanceMethods
@@ -24,6 +24,12 @@ module HTTPX
24
24
  @informational_status: Integer?
25
25
  end
26
26
 
27
+ module ConnectionMethods
28
+ private
29
+
30
+ def set_request_expect_timeout: (Request request) -> void
31
+ end
32
+
27
33
  interface _ExpectOptions
28
34
  def expect_timeout: () -> Integer?
29
35
 
@@ -16,19 +16,28 @@ module HTTPX
16
16
 
17
17
  def current_context?: () -> boolish
18
18
 
19
+ def closed_for_select?: () -> bool
20
+
19
21
  def send: (request request) -> void
20
22
 
21
23
  private
22
24
 
23
- def backlog?: () -> bool
25
+ def backlog?: () -> boolish
26
+
27
+ def clear_pending_requests: () -> void
24
28
  end
25
29
 
26
30
  module HTTP1Methods
31
+ def interests: () -> io_interests?
32
+
33
+ def backlog?: () -> bool
27
34
  end
28
35
 
29
36
  module HTTP2Methods
30
37
  @contexts: Hash[Fiber, Set[Request]]
31
38
 
39
+ def backlog?: () -> bool
40
+
32
41
  private
33
42
 
34
43
  def add_to_context: (request request) -> void
@@ -0,0 +1,44 @@
1
+ module HTTPX
2
+ module Plugins
3
+ module Hedging
4
+ interface _HedgingOptions
5
+ def hedge_after: () -> (^(requestHedging request, Response response) -> interval | interval)?
6
+ end
7
+
8
+ module InstanceMethods
9
+ private
10
+
11
+ def hedge_connection: (connectionHedging connection) -> connectionHedging
12
+
13
+ def hedge_request!: (requestHedging request, connectionHedging connection, Selector selector) -> void
14
+
15
+ def when_to_hedge: (requestHedging request) -> interval?
16
+ end
17
+
18
+ module RequestMethods
19
+ attr_reader hedge_request: requestHedging?
20
+
21
+ @is_hedge_request: bool
22
+
23
+ def hedge_request=: (requestHedging? request) -> void
24
+ end
25
+
26
+ module ConnectionMethods
27
+ attr_reader hedge_connection: connectionHedging?
28
+
29
+ attr_accessor is_hedge_connection: bool
30
+
31
+ def hedge_connection=: (connectionHedging? connection) -> void
32
+
33
+ def try_yield_connection: [T] () { (connectionHedging) -> T } -> T
34
+ end
35
+ end
36
+ type optionsHedging = Options & Hedging::_HedgingOptions
37
+
38
+ type sessionHedging = Session & Hedging::InstanceMethods
39
+
40
+ type requestHedging = Request & Hedging::RequestMethods
41
+
42
+ type connectionHedging = Connection & Hedging::ConnectionMethods
43
+ end
44
+ end
@@ -2,6 +2,13 @@ module HTTPX
2
2
  module Plugins
3
3
  module Proxy
4
4
  module HTTP
5
+ module OptionsMethods
6
+ def connect_request_class: () -> singleton(Request) # & ConnectRequestMethods)
7
+
8
+ def proxy_headers: () -> Headers?
9
+
10
+ def enable_proxy_tunnel: () -> bool?
11
+ end
5
12
 
6
13
  module InstanceMethods
7
14
  def with_proxy_basic_auth: (Hash[Symbol, untyped] opts) -> instance
@@ -14,14 +21,14 @@ module HTTPX
14
21
  module ConnectionMethods
15
22
  @tunnel_parser: Connection::HTTP1 | Connection::HTTP2
16
23
 
17
- def __http_proxy_connect: (Connection::_Parser parser) -> void
24
+ def __http_proxy_connect: () -> void
18
25
  def __http_on_connect: (top, Response) -> void
19
26
  end
20
27
 
21
28
  module ProxyParser
22
29
  end
23
30
 
24
- class ConnectRequest < Request
31
+ module ConnectRequestMethods : Request
25
32
  def initialize: (generic_uri uri, Options options) -> void
26
33
  end
27
34
  end
@@ -26,6 +26,7 @@ module HTTPX
26
26
 
27
27
  @ns: Integer
28
28
  @uris: Array[URI::Generic | String]
29
+ @initial_credentials: boolish
29
30
  @authenticator: _Authenticator
30
31
 
31
32
  def shift: () -> void
@@ -38,7 +39,7 @@ module HTTPX
38
39
 
39
40
  private
40
41
 
41
- def initialize: (?uri: generic_uri | Array[generic_uri], ?scheme: String, ?username: String, ?password: String, ?no_proxy: Array[generic_uri] | generic_uri, **untyped) -> void
42
+ def initialize: (?uri: generic_uri | Array[generic_uri], ?ns: Integer, ?scheme: String?, ?username: String?, ?password: String?, ?no_proxy: Array[generic_uri] | generic_uri | nil, **untyped) -> void
42
43
 
43
44
  def infer_default_auth_scheme: (URI::Generic uri) -> String?
44
45
 
@@ -58,7 +59,7 @@ module HTTPX
58
59
  end
59
60
 
60
61
  module InstanceMethods
61
- @__proxy_uris: Array[generic_uri]
62
+ @proxy_parameters: Parameters?
62
63
 
63
64
  private
64
65
 
@@ -45,11 +45,11 @@ module HTTPX
45
45
 
46
46
  def try_partial_retry: (retriesRequest request, retriesResponse response) -> void
47
47
 
48
- def prepare_to_retry: (retriesRequest request, retriesResponse response) -> void
48
+ def prepare_to_retry: (retriesRequest request, retriesResponse response, interval? retry_after) -> void
49
49
 
50
50
  def can_reconnect?: (retriesRequest request, retriesResponse response) -> bool
51
51
 
52
- def when_to_retry: (retriesRequest request, retriesResponse response, retriesOptions options) -> Numeric?
52
+ def when_to_retry: (retriesRequest request, retriesResponse response, retriesOptions options) -> interval?
53
53
  end
54
54
 
55
55
  module RequestMethods
@@ -33,8 +33,6 @@ module HTTPX
33
33
  include _Selectable
34
34
 
35
35
  def wakeup: () -> void
36
-
37
- def inflight?: () -> bool
38
36
  end
39
37
 
40
38
  module InstanceMethods
@@ -2,13 +2,13 @@ module HTTPX
2
2
  module Plugins
3
3
  module Tracing
4
4
  interface _Tracer
5
- def enabled?: (retriesRequest request) -> boolish
5
+ def enabled?: (tracingRequest request) -> boolish
6
6
 
7
- def start: (retriesRequest request) -> void
7
+ def start: (tracingRequest request) -> void
8
8
 
9
- def reset: (retriesRequest request) -> void
9
+ def reset: (tracingRequest request) -> void
10
10
 
11
- def finish: (retriesRequest request, response response) -> void
11
+ def finish: (tracingRequest request, response response) -> void
12
12
  end
13
13
 
14
14
  class Wrapper
@@ -27,13 +27,30 @@ module HTTPX
27
27
 
28
28
  module RequestMethods
29
29
  attr_accessor init_time: Time?
30
+
31
+ attr_accessor handshake_time: Float?
32
+
33
+ attr_accessor enqueue_time: Time?
34
+
35
+ private
36
+
37
+ def calculate_init_time: () -> Time
30
38
  end
31
39
 
32
40
  module ConnectionMethods
33
41
  @init_time: Time?
34
42
  end
35
43
 
36
- type retriesRequest = Request & RequestMethods
44
+ module HTTP2Methods
45
+ @handshake_init_time: Time
46
+ @pending: Array[tracingRequest]
47
+
48
+ private
49
+
50
+ def on_settings: (*untyped) -> void
51
+ end
52
+
53
+ type tracingRequest = Request & RequestMethods
37
54
  end
38
55
 
39
56
  type sessionTracing = Session
data/sig/request/body.rbs CHANGED
@@ -4,7 +4,7 @@ module HTTPX
4
4
 
5
5
  @headers: Headers
6
6
  @body: body_encoder?
7
- @unbounded_body: bool
7
+ @unbounded_body: bool?
8
8
 
9
9
  def initialize: (Headers h, Options options, **untyped) -> void
10
10
 
@@ -4,10 +4,10 @@ module HTTPX
4
4
 
5
5
  @expires_in: interval
6
6
 
7
- def initialize: (IPAddr | _ToS address, ?Numeric expires_in, ?rescue_on_convert: boolish) -> void
7
+ def initialize: (ipaddr address, ?Numeric expires_in, ?rescue_on_convert: boolish) -> void
8
8
 
9
9
  def expired?: () -> bool
10
10
 
11
- def self.convert: (IPAddr | _ToS address) -> Resolver::Entry
11
+ def self.convert: (ipaddr address) -> Resolver::Entry
12
12
  end
13
13
  end
@@ -37,6 +37,8 @@ module HTTPX
37
37
 
38
38
  # def closed?: () -> bool
39
39
 
40
+ def closed_for_select?: () -> bool
41
+
40
42
  def deactivate: () -> void
41
43
 
42
44
  def terminate: () -> void
@@ -23,10 +23,13 @@ module HTTPX
23
23
  @large_packet: Buffer?
24
24
  @io: UDP | TCP
25
25
  @name: String?
26
+ @message_id: Integer?
26
27
  @timer: Timers::Timer?
27
28
 
28
29
  attr_reader state: Symbol
29
30
 
31
+ def closed_for_select?: () -> bool
32
+
30
33
  def call: () -> void
31
34
 
32
35
  def interests: () -> (:r | :w | nil)
@@ -13,7 +13,7 @@ module HTTPX
13
13
 
14
14
  attr_reader options: Options
15
15
 
16
- attr_writer current_selector: Selector?
16
+ attr_accessor current_selector: Selector?
17
17
 
18
18
  attr_writer current_session: Session?
19
19
 
@@ -19,6 +19,8 @@ module HTTPX
19
19
 
20
20
  attr_reader state: Symbol
21
21
 
22
+ def closed_for_select?: () -> bool
23
+
22
24
  def initialize: (Options options) -> void
23
25
 
24
26
  private
data/sig/resolver.rbs CHANGED
@@ -17,7 +17,7 @@ module HTTPX
17
17
  self.@hosts_resolver: Resolv::Hosts
18
18
  self.@supported_ip_families: Array[Integer]
19
19
 
20
- type dns_decoding_response = [:ok, Array[dns_result]] | [:decode_error, Resolv::DNS::DecodeError] | [:retriable_error | :dns_error, Integer] | Symbol
20
+ type dns_decoding_response = [:ok, Array[dns_result], Integer] | [:decode_error, Resolv::DNS::DecodeError] | [:retriable_error | :dns_error, Integer, Integer] | [:no_domain_found | :message_truncated, nil, Integer]
21
21
 
22
22
  def self?.supported_ip_families: () -> Array[ip_family]
23
23
 
data/sig/response.rbs CHANGED
@@ -60,8 +60,7 @@ module HTTPX
60
60
  end
61
61
 
62
62
  class ContentType
63
- MIME_TYPE_RE: Regexp
64
- CHARSET_RE: Regexp
63
+ SPLIT_PATTERN: Regexp
65
64
 
66
65
  @header_value: String?
67
66
  @mime_type: String?
data/sig/selector.rbs CHANGED
@@ -2,6 +2,8 @@ module HTTPX
2
2
  interface _Selectable
3
3
  def state: () -> Symbol
4
4
 
5
+ def closed_for_select?: () -> bool
6
+
5
7
  def to_io: () -> IO
6
8
 
7
9
  def call: () -> void
@@ -21,9 +23,12 @@ module HTTPX
21
23
  def force_close: (?bool delete_pending) -> void
22
24
 
23
25
  def terminate: () -> void
26
+
27
+ def inflight?: () -> boolish
24
28
  end
25
29
 
26
30
  class Selector
31
+ HAS_FIBER_SCHEDULER: bool
27
32
 
28
33
  type selectable = Resolver::Resolver | Connection | (Object & _Loggable & _Selectable)
29
34
 
@@ -33,20 +38,23 @@ module HTTPX
33
38
 
34
39
  READABLE: Array[io_interests]
35
40
  WRITABLE: Array[io_interests]
41
+ MAX_BUSY_ITERATIONS: Integer
36
42
 
37
43
  @timers: Timers
38
44
 
39
45
  @selectables: Array[selectable]
40
46
  @is_timer_interval: bool
47
+ @busy_iterations: Integer
48
+ @last_select_registered: Integer?
41
49
 
42
50
  def each: () -> ::Enumerator[selectable, self]
43
51
  | () { (selectable) -> void } -> self
44
52
 
45
53
  def next_tick: () -> void
46
54
 
47
- def terminate: () -> void
55
+ def terminate: (?Array[selectable]) -> void
48
56
 
49
- def find_resolver: (Options options) -> Resolver::Resolver?
57
+ def find_resolver: (Options options) -> resolver?
50
58
 
51
59
  def find_connection: (http_uri request_uri, Options options) -> Connection?
52
60
 
@@ -69,12 +77,18 @@ module HTTPX
69
77
 
70
78
  def select_many: (io_select_selectable r, io_select_selectable w, interval? interval) { (selectable) -> void } -> void
71
79
 
80
+ def selectables_with_closed_ios: (io_select_selectable r, io_select_selectable w) -> _Each[selectable]
81
+
72
82
  def select_one: (selectable io, io_interests interests, interval? interval) { (selectable) -> void } -> void
73
83
 
74
84
  def next_timeout: () -> interval?
75
85
 
86
+ def busy_loop_check: (interval? timeout) -> void
87
+
88
+ def busy_loop_error_message: (interval? timeout) -> String
89
+
76
90
  def rw_wait: (io_select_selectable IO, interval? interval) -> untyped?
77
91
  end
78
92
 
79
93
  type io_interests = :r | :w | :rw
80
- end
94
+ end
data/sig/session.rbs CHANGED
@@ -15,8 +15,6 @@ module HTTPX
15
15
  @wrapped: bool
16
16
  @closing: bool
17
17
 
18
- type resolver = Resolver::Multi | Resolver::Resolver
19
-
20
18
  def wrap: () { (instance) -> void } -> void
21
19
 
22
20
  def close: (?Selector selector) -> void
@@ -42,21 +40,25 @@ module HTTPX
42
40
  def initialize: (?options) { (self) -> void } -> void
43
41
  | (?options) -> void
44
42
 
45
- def selector_close: (Selector close) -> void
43
+ def can_checkin?: (Connection connection) -> boolish
44
+
45
+ def selector_close: (Selector close, *untyped) -> void
46
46
 
47
- def deactivate: (Selector selector) -> void
47
+ def deactivate: (Selector selector, ?Exception? error) -> void
48
48
 
49
49
  def on_promise: (untyped, untyped) -> void
50
50
 
51
51
  def fetch_response: (Request request, Selector selector, Options options) -> response?
52
52
 
53
- def send_request: (Request request, Selector selector, ?Options options) -> void
53
+ def send_request: (Request request, Selector selector, ?Options options) ?{ (Connection) -> void } -> void
54
+
55
+ def do_request: (Request request, Connection connection, Selector selector) -> void
54
56
 
55
57
  def set_request_callbacks: (Request request) -> void
56
58
 
57
59
  def build_requests: (verb, uri, request_params) -> Array[Request]
58
60
  | (Array[[verb, uri] | [verb, uri, request_params]], ?request_params) -> Array[Request]
59
- | (verb, _Each[[uri] | [uri, request_params]], request_params) -> Array[Request]
61
+ | (verb, _Each[uri | [uri] | [uri, request_params]], request_params) -> Array[Request]
60
62
 
61
63
  def do_init_connection: (Connection connection, Selector selector) -> void
62
64
 
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.8.4
4
+ version: 1.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tiago Cardoso
@@ -173,6 +173,8 @@ extra_rdoc_files:
173
173
  - doc/release_notes/1_8_2.md
174
174
  - doc/release_notes/1_8_3.md
175
175
  - doc/release_notes/1_8_4.md
176
+ - doc/release_notes/1_9_0.md
177
+ - doc/release_notes/1_9_1.md
176
178
  files:
177
179
  - LICENSE.txt
178
180
  - README.md
@@ -318,6 +320,8 @@ files:
318
320
  - doc/release_notes/1_8_2.md
319
321
  - doc/release_notes/1_8_3.md
320
322
  - doc/release_notes/1_8_4.md
323
+ - doc/release_notes/1_9_0.md
324
+ - doc/release_notes/1_9_1.md
321
325
  - lib/httpx.rb
322
326
  - lib/httpx/adapters/datadog.rb
323
327
  - lib/httpx/adapters/faraday.rb
@@ -373,6 +377,7 @@ files:
373
377
  - lib/httpx/plugins/grpc/grpc_encoding.rb
374
378
  - lib/httpx/plugins/grpc/message.rb
375
379
  - lib/httpx/plugins/h2c.rb
380
+ - lib/httpx/plugins/hedging.rb
376
381
  - lib/httpx/plugins/internal_telemetry.rb
377
382
  - lib/httpx/plugins/ntlm_auth.rb
378
383
  - lib/httpx/plugins/ntlm_v2_auth.rb
@@ -484,6 +489,7 @@ files:
484
489
  - sig/plugins/grpc/grpc_encoding.rbs
485
490
  - sig/plugins/grpc/message.rbs
486
491
  - sig/plugins/h2c.rbs
492
+ - sig/plugins/hedging.rbs
487
493
  - sig/plugins/ntlm_auth.rbs
488
494
  - sig/plugins/ntlm_v2_auth.rbs
489
495
  - sig/plugins/oauth.rbs