httpx 1.9.0 → 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 (61) 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 +7 -7
  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 +14 -1
  10. data/lib/httpx/connection/http1.rb +24 -17
  11. data/lib/httpx/connection/http2.rb +108 -29
  12. data/lib/httpx/connection.rb +158 -162
  13. data/lib/httpx/io/tcp.rb +24 -7
  14. data/lib/httpx/plugins/aws_sigv4.rb +0 -1
  15. data/lib/httpx/plugins/cache.rb +1 -1
  16. data/lib/httpx/plugins/callbacks.rb +1 -0
  17. data/lib/httpx/plugins/content_digest.rb +3 -5
  18. data/lib/httpx/plugins/expect.rb +8 -1
  19. data/lib/httpx/plugins/fiber_concurrency.rb +56 -19
  20. data/lib/httpx/plugins/h2c.rb +12 -11
  21. data/lib/httpx/plugins/hedging.rb +2 -2
  22. data/lib/httpx/plugins/ntlm_auth.rb +4 -3
  23. data/lib/httpx/plugins/ntlm_v2_auth.rb +4 -3
  24. data/lib/httpx/plugins/oauth.rb +1 -1
  25. data/lib/httpx/plugins/proxy/http.rb +23 -16
  26. data/lib/httpx/plugins/proxy/socks5.rb +4 -4
  27. data/lib/httpx/plugins/proxy.rb +8 -15
  28. data/lib/httpx/plugins/query.rb +1 -0
  29. data/lib/httpx/plugins/stream.rb +12 -10
  30. data/lib/httpx/plugins/stream_bidi.rb +4 -0
  31. data/lib/httpx/plugins/tracing.rb +62 -21
  32. data/lib/httpx/plugins/upgrade/h2.rb +2 -2
  33. data/lib/httpx/request.rb +1 -1
  34. data/lib/httpx/resolver/https.rb +3 -2
  35. data/lib/httpx/resolver/native.rb +19 -9
  36. data/lib/httpx/resolver/resolver.rb +2 -2
  37. data/lib/httpx/resolver/system.rb +4 -0
  38. data/lib/httpx/resolver.rb +5 -5
  39. data/lib/httpx/response.rb +5 -1
  40. data/lib/httpx/selector.rb +108 -7
  41. data/lib/httpx/transcoder/json.rb +1 -1
  42. data/lib/httpx/version.rb +1 -1
  43. data/lib/httpx.rb +1 -0
  44. data/sig/chainable.rbs +2 -1
  45. data/sig/connection/http1.rbs +4 -2
  46. data/sig/connection/http2.rbs +8 -2
  47. data/sig/connection.rbs +11 -6
  48. data/sig/io/tcp.rbs +5 -0
  49. data/sig/plugins/expect.rbs +6 -0
  50. data/sig/plugins/fiber_concurrency.rbs +10 -1
  51. data/sig/plugins/proxy/http.rbs +3 -1
  52. data/sig/plugins/stream_bidi.rbs +0 -2
  53. data/sig/plugins/tracing.rbs +10 -2
  54. data/sig/resolver/https.rbs +2 -0
  55. data/sig/resolver/native.rbs +3 -0
  56. data/sig/resolver/resolver.rbs +1 -1
  57. data/sig/resolver/system.rbs +2 -0
  58. data/sig/resolver.rbs +1 -1
  59. data/sig/selector.rbs +15 -1
  60. data/sig/session.rbs +1 -1
  61. metadata +3 -1
data/sig/connection.rbs CHANGED
@@ -37,7 +37,6 @@ module HTTPX
37
37
 
38
38
 
39
39
  @window_size: Integer
40
- @inflight: Integer
41
40
  @max_concurrent_requests: Integer?
42
41
  @keep_alive_timeout: interval?
43
42
  @timeout: interval?
@@ -91,6 +90,8 @@ module HTTPX
91
90
 
92
91
  def inflight?: () -> boolish
93
92
 
93
+ def closed_for_select?: () -> bool
94
+
94
95
  def interests: () -> io_interests?
95
96
 
96
97
  def to_io: () -> IO
@@ -139,6 +140,10 @@ module HTTPX
139
140
 
140
141
  def initialize_type: (http_uri uri, Options options) -> io_type
141
142
 
143
+ def connect_attempt_time_left: () -> interval?
144
+
145
+ def connect_next: (StandardError error) -> void
146
+
142
147
  def try_connect: () -> void
143
148
 
144
149
  def connect: () -> void
@@ -151,12 +156,12 @@ module HTTPX
151
156
 
152
157
  def parser: () -> (Object & _Parser)
153
158
 
154
- def send_request_to_parser: (Request request) -> void
155
-
156
- def enqueue_pending_requests_from_parser: (HTTP1 | HTTP2 parser) -> void
159
+ def send_request_to_parser: (Request request, ?bool head) -> bool
157
160
 
158
161
  def build_parser: (?String protocol) -> (Object & _Parser)
159
162
 
163
+ def on_parser_error: (Request request, Exception | Symbol error) -> void
164
+
160
165
  def set_parser_callbacks: (HTTP1 | HTTP2 parser) -> void
161
166
 
162
167
  def transition: (Symbol nextstate) -> void
@@ -173,9 +178,9 @@ module HTTPX
173
178
 
174
179
  def no_more_selector_check: () -> void
175
180
 
176
- def no_more_requests_loop_check: () -> void
181
+ def clear_pending_requests: () -> void
177
182
 
178
- def no_more_requests?: () -> bool
183
+ def no_more_requests?: () -> boolish
179
184
 
180
185
  def handle_error: (StandardError error, ?Request? request) -> void
181
186
 
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
@@ -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
@@ -3,6 +3,8 @@ module HTTPX
3
3
  module Proxy
4
4
  module HTTP
5
5
  module OptionsMethods
6
+ def connect_request_class: () -> singleton(Request) # & ConnectRequestMethods)
7
+
6
8
  def proxy_headers: () -> Headers?
7
9
 
8
10
  def enable_proxy_tunnel: () -> bool?
@@ -26,7 +28,7 @@ module HTTPX
26
28
  module ProxyParser
27
29
  end
28
30
 
29
- class ConnectRequest < Request
31
+ module ConnectRequestMethods : Request
30
32
  def initialize: (generic_uri uri, Options options) -> void
31
33
  end
32
34
  end
@@ -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
@@ -29,6 +29,12 @@ module HTTPX
29
29
  attr_accessor init_time: Time?
30
30
 
31
31
  attr_accessor handshake_time: Float?
32
+
33
+ attr_accessor enqueue_time: Time?
34
+
35
+ private
36
+
37
+ def calculate_init_time: () -> Time
32
38
  end
33
39
 
34
40
  module ConnectionMethods
@@ -36,10 +42,12 @@ module HTTPX
36
42
  end
37
43
 
38
44
  module HTTP2Methods
39
- @handshake_time: Float?
40
45
  @handshake_init_time: Time
46
+ @pending: Array[tracingRequest]
47
+
48
+ private
41
49
 
42
- def send: (tracingRequest request, ?bool head) -> bool
50
+ def on_settings: (*untyped) -> void
43
51
  end
44
52
 
45
53
  type tracingRequest = Request & RequestMethods
@@ -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/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,11 +38,14 @@ 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
@@ -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
@@ -58,7 +58,7 @@ module HTTPX
58
58
 
59
59
  def build_requests: (verb, uri, request_params) -> Array[Request]
60
60
  | (Array[[verb, uri] | [verb, uri, request_params]], ?request_params) -> Array[Request]
61
- | (verb, _Each[[uri] | [uri, request_params]], request_params) -> Array[Request]
61
+ | (verb, _Each[uri | [uri] | [uri, request_params]], request_params) -> Array[Request]
62
62
 
63
63
  def do_init_connection: (Connection connection, Selector selector) -> void
64
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.9.0
4
+ version: 1.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tiago Cardoso
@@ -174,6 +174,7 @@ extra_rdoc_files:
174
174
  - doc/release_notes/1_8_3.md
175
175
  - doc/release_notes/1_8_4.md
176
176
  - doc/release_notes/1_9_0.md
177
+ - doc/release_notes/1_9_1.md
177
178
  files:
178
179
  - LICENSE.txt
179
180
  - README.md
@@ -320,6 +321,7 @@ files:
320
321
  - doc/release_notes/1_8_3.md
321
322
  - doc/release_notes/1_8_4.md
322
323
  - doc/release_notes/1_9_0.md
324
+ - doc/release_notes/1_9_1.md
323
325
  - lib/httpx.rb
324
326
  - lib/httpx/adapters/datadog.rb
325
327
  - lib/httpx/adapters/faraday.rb