httpx 1.7.2 → 1.7.5

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/README.md +3 -1
  3. data/doc/release_notes/1_7_3.md +29 -0
  4. data/doc/release_notes/1_7_4.md +42 -0
  5. data/doc/release_notes/1_7_5.md +10 -0
  6. data/lib/httpx/adapters/datadog.rb +24 -64
  7. data/lib/httpx/adapters/webmock.rb +3 -4
  8. data/lib/httpx/connection/http1.rb +6 -1
  9. data/lib/httpx/connection/http2.rb +43 -30
  10. data/lib/httpx/connection.rb +74 -22
  11. data/lib/httpx/plugins/auth/digest.rb +2 -1
  12. data/lib/httpx/plugins/brotli.rb +33 -5
  13. data/lib/httpx/plugins/cookies/cookie.rb +34 -11
  14. data/lib/httpx/plugins/cookies/jar.rb +93 -18
  15. data/lib/httpx/plugins/cookies.rb +7 -3
  16. data/lib/httpx/plugins/expect.rb +33 -3
  17. data/lib/httpx/plugins/fiber_concurrency.rb +2 -4
  18. data/lib/httpx/plugins/follow_redirects.rb +7 -1
  19. data/lib/httpx/plugins/h2c.rb +1 -1
  20. data/lib/httpx/plugins/proxy/http.rb +15 -8
  21. data/lib/httpx/plugins/proxy.rb +10 -2
  22. data/lib/httpx/plugins/rate_limiter.rb +19 -19
  23. data/lib/httpx/plugins/retries.rb +17 -9
  24. data/lib/httpx/plugins/ssrf_filter.rb +1 -0
  25. data/lib/httpx/plugins/stream_bidi.rb +6 -0
  26. data/lib/httpx/plugins/tracing.rb +137 -0
  27. data/lib/httpx/request.rb +1 -1
  28. data/lib/httpx/resolver/multi.rb +1 -8
  29. data/lib/httpx/resolver/native.rb +1 -1
  30. data/lib/httpx/resolver/resolver.rb +21 -2
  31. data/lib/httpx/resolver/system.rb +3 -1
  32. data/lib/httpx/selector.rb +7 -7
  33. data/lib/httpx/session.rb +30 -44
  34. data/lib/httpx/timers.rb +4 -0
  35. data/lib/httpx/version.rb +1 -1
  36. data/sig/chainable.rbs +2 -1
  37. data/sig/connection/http1.rbs +2 -0
  38. data/sig/connection/http2.rbs +11 -4
  39. data/sig/connection.rbs +7 -0
  40. data/sig/plugins/brotli.rbs +11 -6
  41. data/sig/plugins/cookies/cookie.rbs +3 -2
  42. data/sig/plugins/cookies/jar.rbs +11 -0
  43. data/sig/plugins/cookies.rbs +2 -0
  44. data/sig/plugins/expect.rbs +21 -2
  45. data/sig/plugins/fiber_concurrency.rbs +2 -2
  46. data/sig/plugins/proxy/socks4.rbs +4 -0
  47. data/sig/plugins/rate_limiter.rbs +2 -2
  48. data/sig/plugins/response_cache.rbs +3 -3
  49. data/sig/plugins/retries.rbs +17 -13
  50. data/sig/plugins/tracing.rbs +41 -0
  51. data/sig/request.rbs +1 -0
  52. data/sig/resolver/native.rbs +2 -0
  53. data/sig/resolver/resolver.rbs +4 -2
  54. data/sig/resolver/system.rbs +0 -2
  55. data/sig/response/body.rbs +1 -1
  56. data/sig/selector.rbs +7 -2
  57. data/sig/session.rbs +2 -0
  58. data/sig/timers.rbs +2 -0
  59. data/sig/transcoder/gzip.rbs +1 -1
  60. data/sig/transcoder.rbs +0 -2
  61. metadata +11 -3
@@ -9,12 +9,12 @@ module HTTPX
9
9
 
10
10
  def set_context!: () -> void
11
11
 
12
- def current_context?: () -> bool
12
+ def current_context?: () -> boolish
13
13
  end
14
14
 
15
15
  module ConnectionMethods
16
16
 
17
- def current_context?: () -> bool
17
+ def current_context?: () -> boolish
18
18
 
19
19
  def send: (request request) -> void
20
20
  end
@@ -5,6 +5,10 @@ module HTTPX
5
5
  module Plugins
6
6
  module Proxy
7
7
  module Socks4
8
+ VERSION: Integer
9
+ CONNECT: Integer
10
+ GRANTED: Integer
11
+ PROTOCOLS: Array[String]
8
12
 
9
13
  module ConnectionMethods
10
14
  def __socks4_proxy_connect: () -> void
@@ -5,11 +5,11 @@ module HTTPX
5
5
 
6
6
  def self.load_dependencies: (singleton(Session)) -> void
7
7
 
8
- def self.retry_after_rate_limit: (untyped, response) -> Numeric?
9
-
10
8
  module InstanceMethods
11
9
  def rate_limit_error?: (response response) -> bool
12
10
  end
13
11
  end
12
+
13
+ type sessionRateLimiter = Session & RateLimiter::InstanceMethods
14
14
  end
15
15
  end
@@ -51,7 +51,7 @@ module HTTPX
51
51
  module ResponseMethods
52
52
  attr_writer original_request: cacheRequest
53
53
 
54
- @cache: bool
54
+ @cached: bool
55
55
  @cache_control: Array[String]?
56
56
  @vary: Array[String]?
57
57
  @date: Time?
@@ -66,9 +66,9 @@ module HTTPX
66
66
 
67
67
  def fresh?: () -> bool
68
68
 
69
- def cache_control: () -> Array[String]?
69
+ %a{pure} def cache_control: () -> Array[String]?
70
70
 
71
- def vary: () -> Array[String]?
71
+ %a{pure} def vary: () -> Array[String]?
72
72
 
73
73
  private
74
74
 
@@ -8,16 +8,16 @@ module HTTPX
8
8
  DEFAULT_JITTER: ^(Numeric) -> Numeric
9
9
  BACKOFF_ALGORITHMS: Array[Symbol]
10
10
 
11
- def self?.retry_after_polynomial_backoff: (retriesRequest request, response response) -> Numeric
11
+ def self?.retry_after_polynomial_backoff: (retriesRequest request, retriesResponse response) -> Numeric
12
12
 
13
- def self?.retry_after_exponential_backoff: (retriesRequest request, response response) -> Numeric
13
+ def self?.retry_after_exponential_backoff: (retriesRequest request, retriesResponse response) -> Numeric
14
14
 
15
15
  interface _RetryCallback
16
- def call: (response response) -> bool?
16
+ def call: (retriesResponse response) -> bool?
17
17
  end
18
18
 
19
19
  interface _RetriesOptions
20
- def retry_after: () -> (^(retriesRequest request, response response) -> Numeric | Numeric)?
20
+ def retry_after: () -> (^(retriesRequest request, retriesResponse response) -> Numeric | Numeric)?
21
21
 
22
22
  def retry_jitter: () -> ^(Numeric jitter) -> Numeric
23
23
 
@@ -35,17 +35,19 @@ module HTTPX
35
35
 
36
36
  private
37
37
 
38
- def fetch_response: (retriesRequest request, Selector selector, retriesOptions options) -> (retriesResponse | ErrorResponse)?
38
+ def fetch_response: (retriesRequest request, Selector selector, retriesOptions options) -> retriesResponse?
39
39
 
40
- def retryable_request?: (retriesRequest request, response response, retriesOptions options) -> boolish
40
+ def retryable_request?: (retriesRequest request, retriesResponse response, retriesOptions options) -> boolish
41
41
 
42
- def retryable_response?: (response response, retriesOptions options) -> boolish
42
+ def retryable_response?: (retriesResponse response, retriesOptions options) -> boolish
43
43
 
44
44
  def retryable_error?: (_Exception error, Options options) -> boolish
45
45
 
46
- def try_partial_retry: (retriesRequest request, (retriesResponse | ErrorResponse) response) -> void
46
+ def try_partial_retry: (retriesRequest request, retriesResponse response) -> void
47
47
 
48
- def prepare_to_retry: (Request & RequestMethods request, response response) -> void
48
+ def prepare_to_retry: (Request & RequestMethods request, retriesResponse response) -> void
49
+
50
+ def when_to_retry: (Request & RequestMethods request, retriesResponse response, retriesOptions options) -> void
49
51
  end
50
52
 
51
53
  module RequestMethods
@@ -53,20 +55,22 @@ module HTTPX
53
55
 
54
56
  attr_accessor retries: Integer
55
57
 
56
- attr_writer partial_response: Response?
58
+ attr_writer partial_response: retriesResponse?
57
59
 
58
- def response=: (retriesResponse | ErrorResponse response) -> void
60
+ def response=: (retriesResponse response) -> void
59
61
  end
60
62
 
61
63
  module ResponseMethods
62
- def from_partial_response: (Response response) -> void
64
+ def from_partial_response: (retriesHTTPResponse response) -> void
63
65
  end
64
66
 
65
67
  type retriesOptions = Options & _RetriesOptions
66
68
 
67
69
  type retriesRequest = Request & RequestMethods
68
70
 
69
- type retriesResponse = Response & ResponseMethods
71
+ type retriesHTTPResponse = Response & ResponseMethods
72
+
73
+ type retriesResponse = retriesHTTPResponse | ErrorResponse
70
74
  end
71
75
 
72
76
  type sessionRetries = Session & Retries::InstanceMethods
@@ -0,0 +1,41 @@
1
+ module HTTPX
2
+ module Plugins
3
+ module Tracing
4
+ interface _Tracer
5
+ def enabled?: (retriesRequest request) -> boolish
6
+
7
+ def start: (retriesRequest request) -> void
8
+
9
+ def reset: (retriesRequest request) -> void
10
+
11
+ def finish: (retriesRequest request, response response) -> void
12
+ end
13
+
14
+ class Wrapper
15
+ include _Tracer
16
+
17
+ attr_reader tracers: Array[_Tracer]
18
+
19
+ def initialize: (*_Tracer tracers) -> void
20
+
21
+ def merge: (instance | _Tracer) -> void
22
+ end
23
+
24
+ interface _RetriesOptions
25
+ def tracer: () -> _Tracer
26
+ end
27
+
28
+ module RequestMethods
29
+ attr_accessor init_time: Time?
30
+ end
31
+
32
+ module ConnectionMethods
33
+ @init_time: Time
34
+ end
35
+
36
+ type retriesRequest = Request & RequestMethods
37
+ end
38
+
39
+ type sessionTracing = Session
40
+ end
41
+ end
data/sig/request.rbs CHANGED
@@ -6,6 +6,7 @@ module HTTPX
6
6
 
7
7
  METHODS: Array[Symbol]
8
8
  USER_AGENT: String
9
+ ALLOWED_URI_SCHEMES: Array[String]
9
10
 
10
11
  attr_reader verb: verb
11
12
  attr_reader uri: http_uri
@@ -37,6 +37,8 @@ module HTTPX
37
37
 
38
38
  def handle_socket_timeout: (Numeric interval) -> void
39
39
 
40
+ def on_io_error: (IOError error) -> void
41
+
40
42
  private
41
43
 
42
44
  def initialize: (ip_family family, options options) -> void
@@ -27,8 +27,6 @@ module HTTPX
27
27
 
28
28
  def terminate: () -> void
29
29
 
30
- def force_close: (*untyped args) -> void
31
-
32
30
  def closed?: () -> bool
33
31
 
34
32
  def empty?: () -> bool
@@ -43,6 +41,8 @@ module HTTPX
43
41
 
44
42
  def early_resolve: (Connection connection, ?hostname: String) -> bool
45
43
 
44
+ def lazy_resolve: (Connection connection) -> void
45
+
46
46
  private
47
47
 
48
48
  def resolve: (?Connection connection, ?String hostname) -> void
@@ -60,6 +60,8 @@ module HTTPX
60
60
  def resolve_error: (String hostname, ?StandardError?) -> (ResolveError | ResolveTimeoutError)
61
61
 
62
62
  def close_or_resolve: () -> void
63
+
64
+ def disconnect: () -> void
63
65
  end
64
66
  end
65
67
  end
@@ -18,8 +18,6 @@ module HTTPX
18
18
 
19
19
  def initialize: (Options options) -> void
20
20
 
21
- def lazy_resolve: (Connection connection) -> void
22
-
23
21
  private
24
22
 
25
23
  def transition: (Symbol nextstate) -> void
@@ -43,7 +43,7 @@ module HTTPX
43
43
 
44
44
  def initialize_inflaters: () -> void
45
45
 
46
- def self.initialize_inflater_by_encoding: (Encoding | String encoding, Response response, ?bytesize: Integer) -> Transcoder::GZIP::Inflater
46
+ def self.initialize_inflater_by_encoding: (Encoding | String encoding, Response response, ?bytesize: Integer) -> (Object & Transcoder::_Inflater)
47
47
 
48
48
  def decode_chunk: (String chunk) -> String
49
49
 
data/sig/selector.rbs CHANGED
@@ -13,6 +13,10 @@ module HTTPX
13
13
  def handle_socket_timeout: (Numeric interval) -> void
14
14
 
15
15
  def on_error: (StandardError) -> void
16
+
17
+ def on_io_error: (IOError error) -> void
18
+
19
+ def force_close: (?bool delete_pending) -> void
16
20
  end
17
21
 
18
22
  class Selector
@@ -20,8 +24,6 @@ module HTTPX
20
24
 
21
25
  type io_select_selectable = (selectable | Array[selectable])?
22
26
 
23
- include _Each[selectable]
24
-
25
27
  extend Forwardable
26
28
 
27
29
  READABLE: Array[io_interests]
@@ -32,6 +34,9 @@ module HTTPX
32
34
  @selectables: Array[selectable]
33
35
  @is_timer_interval: bool
34
36
 
37
+ def each: () -> ::Enumerator[selectable, self]
38
+ | () { (selectable) -> void } -> self
39
+
35
40
  def next_tick: () -> void
36
41
 
37
42
  def terminate: () -> void
data/sig/session.rbs CHANGED
@@ -66,6 +66,8 @@ module HTTPX
66
66
 
67
67
  def receive_requests: (Array[Request] requests, Selector selector) -> Array[response]
68
68
 
69
+ def early_resolve: (resolver resolver, Connection connection) -> bool
70
+
69
71
  def resolve_connection: (Connection connection, Selector selector) -> void
70
72
 
71
73
  def on_resolver_connection: (Connection connection, Selector selector) -> void
data/sig/timers.rbs CHANGED
@@ -14,6 +14,8 @@ module HTTPX
14
14
 
15
15
  def initialize: () -> void
16
16
 
17
+ def empty?: () -> bool
18
+
17
19
  private
18
20
 
19
21
  def drop_elapsed!: (Numeric elapsed_time) -> void
@@ -16,7 +16,7 @@ module HTTPX
16
16
 
17
17
  class Inflater
18
18
  @inflater: Zlib::Inflate
19
- @bytesize: Integer
19
+ @bytesize: Integer | Float
20
20
 
21
21
  def initialize: (Integer | Float bytesize) -> void
22
22
 
data/sig/transcoder.rbs CHANGED
@@ -31,8 +31,6 @@ module HTTPX
31
31
  end
32
32
 
33
33
  interface _Inflater
34
- def initialize: (Integer | Float bytesize) -> void
35
-
36
34
  def call: (String chunk) -> String
37
35
  end
38
36
 
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.2
4
+ version: 1.7.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tiago Cardoso
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - ">="
17
17
  - !ruby/object:Gem::Version
18
- version: 1.0.0
18
+ version: 1.1.3
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - ">="
24
24
  - !ruby/object:Gem::Version
25
- version: 1.0.0
25
+ version: 1.1.3
26
26
  description: A client library for making HTTP requests from Ruby.
27
27
  email:
28
28
  - cardoso_tiago@hotmail.com
@@ -162,6 +162,9 @@ extra_rdoc_files:
162
162
  - doc/release_notes/1_7_0.md
163
163
  - doc/release_notes/1_7_1.md
164
164
  - doc/release_notes/1_7_2.md
165
+ - doc/release_notes/1_7_3.md
166
+ - doc/release_notes/1_7_4.md
167
+ - doc/release_notes/1_7_5.md
165
168
  files:
166
169
  - LICENSE.txt
167
170
  - README.md
@@ -296,6 +299,9 @@ files:
296
299
  - doc/release_notes/1_7_0.md
297
300
  - doc/release_notes/1_7_1.md
298
301
  - doc/release_notes/1_7_2.md
302
+ - doc/release_notes/1_7_3.md
303
+ - doc/release_notes/1_7_4.md
304
+ - doc/release_notes/1_7_5.md
299
305
  - lib/httpx.rb
300
306
  - lib/httpx/adapters/datadog.rb
301
307
  - lib/httpx/adapters/faraday.rb
@@ -367,6 +373,7 @@ files:
367
373
  - lib/httpx/plugins/ssrf_filter.rb
368
374
  - lib/httpx/plugins/stream.rb
369
375
  - lib/httpx/plugins/stream_bidi.rb
376
+ - lib/httpx/plugins/tracing.rb
370
377
  - lib/httpx/plugins/upgrade.rb
371
378
  - lib/httpx/plugins/upgrade/h2.rb
372
379
  - lib/httpx/plugins/webdav.rb
@@ -472,6 +479,7 @@ files:
472
479
  - sig/plugins/ssrf_filter.rbs
473
480
  - sig/plugins/stream.rbs
474
481
  - sig/plugins/stream_bidi.rbs
482
+ - sig/plugins/tracing.rbs
475
483
  - sig/plugins/upgrade.rbs
476
484
  - sig/plugins/upgrade/h2.rbs
477
485
  - sig/plugins/webdav.rbs