httpx 1.2.6 → 1.4.4

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 (130) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -2
  3. data/doc/release_notes/1_3_0.md +18 -0
  4. data/doc/release_notes/1_3_1.md +17 -0
  5. data/doc/release_notes/1_3_2.md +6 -0
  6. data/doc/release_notes/1_3_3.md +5 -0
  7. data/doc/release_notes/1_3_4.md +6 -0
  8. data/doc/release_notes/1_4_0.md +43 -0
  9. data/doc/release_notes/1_4_1.md +19 -0
  10. data/doc/release_notes/1_4_2.md +20 -0
  11. data/doc/release_notes/1_4_3.md +11 -0
  12. data/doc/release_notes/1_4_4.md +14 -0
  13. data/lib/httpx/adapters/datadog.rb +56 -80
  14. data/lib/httpx/adapters/faraday.rb +5 -2
  15. data/lib/httpx/adapters/webmock.rb +24 -8
  16. data/lib/httpx/callbacks.rb +2 -7
  17. data/lib/httpx/chainable.rb +3 -1
  18. data/lib/httpx/connection/http1.rb +11 -7
  19. data/lib/httpx/connection/http2.rb +57 -34
  20. data/lib/httpx/connection.rb +270 -71
  21. data/lib/httpx/errors.rb +15 -4
  22. data/lib/httpx/io/ssl.rb +6 -3
  23. data/lib/httpx/io/tcp.rb +1 -1
  24. data/lib/httpx/io/unix.rb +1 -1
  25. data/lib/httpx/loggable.rb +17 -10
  26. data/lib/httpx/options.rb +30 -23
  27. data/lib/httpx/plugins/aws_sdk_authentication.rb +3 -0
  28. data/lib/httpx/plugins/aws_sigv4.rb +36 -17
  29. data/lib/httpx/plugins/callbacks.rb +13 -2
  30. data/lib/httpx/plugins/circuit_breaker.rb +11 -5
  31. data/lib/httpx/plugins/content_digest.rb +202 -0
  32. data/lib/httpx/plugins/cookies.rb +9 -6
  33. data/lib/httpx/plugins/digest_auth.rb +3 -0
  34. data/lib/httpx/plugins/expect.rb +10 -4
  35. data/lib/httpx/plugins/follow_redirects.rb +68 -33
  36. data/lib/httpx/plugins/grpc/grpc_encoding.rb +2 -0
  37. data/lib/httpx/plugins/grpc.rb +2 -2
  38. data/lib/httpx/plugins/h2c.rb +23 -20
  39. data/lib/httpx/plugins/internal_telemetry.rb +48 -1
  40. data/lib/httpx/plugins/oauth.rb +1 -1
  41. data/lib/httpx/plugins/persistent.rb +16 -0
  42. data/lib/httpx/plugins/proxy/http.rb +19 -16
  43. data/lib/httpx/plugins/proxy/socks4.rb +1 -1
  44. data/lib/httpx/plugins/proxy/socks5.rb +1 -1
  45. data/lib/httpx/plugins/proxy.rb +96 -85
  46. data/lib/httpx/plugins/retries.rb +28 -10
  47. data/lib/httpx/plugins/ssrf_filter.rb +4 -1
  48. data/lib/httpx/plugins/stream.rb +42 -18
  49. data/lib/httpx/plugins/upgrade.rb +5 -10
  50. data/lib/httpx/plugins/webdav.rb +6 -0
  51. data/lib/httpx/plugins/xml.rb +76 -0
  52. data/lib/httpx/pool.rb +73 -244
  53. data/lib/httpx/request/body.rb +50 -55
  54. data/lib/httpx/request.rb +77 -14
  55. data/lib/httpx/resolver/https.rb +17 -20
  56. data/lib/httpx/resolver/multi.rb +34 -16
  57. data/lib/httpx/resolver/native.rb +140 -61
  58. data/lib/httpx/resolver/resolver.rb +64 -19
  59. data/lib/httpx/resolver/system.rb +32 -16
  60. data/lib/httpx/resolver.rb +21 -14
  61. data/lib/httpx/response/body.rb +12 -1
  62. data/lib/httpx/response.rb +16 -9
  63. data/lib/httpx/selector.rb +170 -91
  64. data/lib/httpx/session.rb +282 -139
  65. data/lib/httpx/timers.rb +17 -2
  66. data/lib/httpx/transcoder/body.rb +15 -29
  67. data/lib/httpx/transcoder/form.rb +2 -0
  68. data/lib/httpx/transcoder/gzip.rb +0 -3
  69. data/lib/httpx/transcoder/json.rb +16 -2
  70. data/lib/httpx/transcoder/multipart/encoder.rb +11 -2
  71. data/lib/httpx/transcoder/multipart/part.rb +1 -1
  72. data/lib/httpx/transcoder/utils/deflater.rb +7 -4
  73. data/lib/httpx/transcoder.rb +0 -1
  74. data/lib/httpx/version.rb +1 -1
  75. data/lib/httpx.rb +20 -21
  76. data/sig/callbacks.rbs +2 -3
  77. data/sig/chainable.rbs +6 -2
  78. data/sig/connection/http1.rbs +2 -2
  79. data/sig/connection/http2.rbs +22 -18
  80. data/sig/connection.rbs +40 -9
  81. data/sig/errors.rbs +9 -3
  82. data/sig/httpx.rbs +3 -3
  83. data/sig/io/tcp.rbs +1 -1
  84. data/sig/io/unix.rbs +1 -1
  85. data/sig/loggable.rbs +4 -2
  86. data/sig/options.rbs +8 -13
  87. data/sig/plugins/aws_sigv4.rbs +8 -2
  88. data/sig/plugins/content_digest.rbs +51 -0
  89. data/sig/plugins/cookies/cookie.rbs +9 -0
  90. data/sig/plugins/follow_redirects.rbs +1 -1
  91. data/sig/plugins/grpc/call.rbs +4 -0
  92. data/sig/plugins/persistent.rbs +4 -1
  93. data/sig/plugins/proxy/http.rbs +3 -0
  94. data/sig/plugins/proxy/socks5.rbs +11 -3
  95. data/sig/plugins/proxy.rbs +18 -9
  96. data/sig/plugins/push_promise.rbs +6 -3
  97. data/sig/plugins/rate_limiter.rbs +2 -0
  98. data/sig/plugins/retries.rbs +1 -1
  99. data/sig/plugins/ssrf_filter.rbs +26 -0
  100. data/sig/plugins/stream.rbs +3 -0
  101. data/sig/plugins/webdav.rbs +23 -0
  102. data/sig/plugins/xml.rbs +37 -0
  103. data/sig/pool.rbs +27 -33
  104. data/sig/request/body.rbs +4 -10
  105. data/sig/request.rbs +14 -1
  106. data/sig/resolver/multi.rbs +26 -1
  107. data/sig/resolver/native.rbs +6 -3
  108. data/sig/resolver/resolver.rbs +22 -3
  109. data/sig/resolver.rbs +5 -1
  110. data/sig/response/body.rbs +2 -2
  111. data/sig/response/buffer.rbs +2 -2
  112. data/sig/response.rbs +9 -4
  113. data/sig/selector.rbs +31 -4
  114. data/sig/session.rbs +54 -20
  115. data/sig/timers.rbs +15 -4
  116. data/sig/transcoder/body.rbs +2 -4
  117. data/sig/transcoder/chunker.rbs +1 -1
  118. data/sig/transcoder/deflate.rbs +1 -0
  119. data/sig/transcoder/form.rbs +8 -0
  120. data/sig/transcoder/gzip.rbs +4 -1
  121. data/sig/transcoder/json.rbs +1 -1
  122. data/sig/transcoder/multipart.rbs +6 -4
  123. data/sig/transcoder/utils/body_reader.rbs +3 -3
  124. data/sig/transcoder/utils/deflater.rbs +2 -3
  125. metadata +32 -14
  126. data/lib/httpx/session2.rb +0 -23
  127. data/lib/httpx/transcoder/utils/inflater.rb +0 -19
  128. data/lib/httpx/transcoder/xml.rb +0 -52
  129. data/sig/transcoder/utils/inflater.rbs +0 -12
  130. data/sig/transcoder/xml.rbs +0 -22
data/sig/response.rbs CHANGED
@@ -1,5 +1,7 @@
1
1
  module HTTPX
2
2
  interface _Response
3
+ def <<: (String data) -> void
4
+
3
5
  def finished?: () -> bool
4
6
 
5
7
  def raise_for_status: () -> self
@@ -23,6 +25,7 @@ module HTTPX
23
25
  @options: Options
24
26
  @request: Request
25
27
  @content_type: ContentType
28
+ @finished: bool
26
29
 
27
30
  def copy_to: (_ToPath | _Writer destination) -> void
28
31
 
@@ -38,9 +41,11 @@ module HTTPX
38
41
 
39
42
  def content_type: () -> ContentType
40
43
 
44
+ def finish!: () -> void
45
+
41
46
  def complete?: () -> bool
42
47
 
43
- def json: (?json_options opts) -> untyped
48
+ def json: (?JSON::options opts) -> untyped
44
49
 
45
50
  def form: () -> Hash[String, untyped]
46
51
 
@@ -77,9 +82,9 @@ module HTTPX
77
82
  @options: Options
78
83
  @error: Exception
79
84
 
80
- attr_reader request: Request
85
+ %a{pure} attr_reader request: Request
81
86
 
82
- attr_reader response: Response?
87
+ %a{pure} attr_reader response: Response?
83
88
 
84
89
  def status: () -> (Integer | _ToS)
85
90
 
@@ -91,7 +96,7 @@ module HTTPX
91
96
 
92
97
  private
93
98
 
94
- def initialize: (Request, Exception, options) -> untyped
99
+ def initialize: (Request, Exception) -> untyped
95
100
  end
96
101
 
97
102
  type response = Response | ErrorResponse
data/sig/selector.rbs CHANGED
@@ -1,22 +1,49 @@
1
1
  module HTTPX
2
+ type selectable = Connection | Resolver::Native
3
+
2
4
  class Selector
3
- type selectable = Connection | Resolver::Native | Resolver::System
5
+ include _Each[selectable]
4
6
 
5
7
  READABLE: Array[Symbol]
6
8
  WRITABLE: Array[Symbol]
9
+
10
+ @timers: Timers
11
+
7
12
  @selectables: Array[selectable]
13
+ @is_timer_interval: bool
14
+
15
+ def next_tick: () -> void
16
+
17
+ def terminate: () -> void
18
+
19
+ def find_resolver: (Options options) -> Resolver::Resolver?
20
+
21
+ def find_connection: (http_uri request_uri, Options options) -> Connection?
22
+
23
+ def each_connection: () { (Connection) -> void} -> void
24
+ | () -> Enumerable[Connection]
25
+
26
+ def find_mergeable_connection: (Connection connection) -> Connection?
27
+
28
+ def empty?: () -> bool
8
29
 
9
30
  def register: (selectable io) -> void
10
- def deregister: (selectable io) -> selectable?
11
31
 
12
- def select: (Numeric? interval) { (selectable) -> void } -> void
32
+ def deregister: (selectable io) -> selectable?
13
33
 
14
34
  private
15
35
 
16
- def initialize: () -> untyped
36
+ def initialize: () -> void
37
+
38
+ def select: (Numeric? interval) { (selectable) -> void } -> void
17
39
 
18
40
  def select_many: (Numeric? interval) { (selectable) -> void } -> void
41
+
19
42
  def select_one: (Numeric? interval) { (selectable) -> void } -> void
43
+
44
+ def next_timeout: () -> Numeric?
45
+
46
+ def emit_error: (StandardError e) -> void
20
47
  end
21
48
 
22
49
  type io_interests = :r | :w | :rw
data/sig/session.rbs CHANGED
@@ -7,49 +7,83 @@ module HTTPX
7
7
 
8
8
  @options: Options
9
9
  @responses: Hash[Request, response]
10
- @persistent: bool?
10
+
11
+ # returns the HTTPX::Pool object which manages the networking required to
12
+ # perform requests.
13
+ @pool: Pool
14
+
15
+ @persistent: bool
16
+ @wrapped: bool
11
17
 
12
18
  def self.plugin: (Symbol | Module plugin, ?options? options) ?{ (Class) -> void } -> singleton(Session)
13
19
 
14
20
  def wrap: () { (instance) -> void } -> void
15
21
 
16
- def close: (*untyped) -> void
22
+ def close: (?Selector selector) -> void
23
+
24
+ def build_request: (verb verb, generic_uri uri, ?request_params params, ?Options options) -> Request
25
+
26
+ def select_connection: (Connection connection, Selector selector) -> void
27
+
28
+ def pin_connection: (Resolver::Resolver | Connection connection, Selector selector) -> void
29
+
30
+ def deselect_connection: (Connection connection, Selector selector, ?bool cloned) -> void
17
31
 
18
- def build_request: (verb, generic_uri, ?options) -> Request
32
+ def select_resolver: (Resolver::Native | Resolver::HTTPS resolver, Selector selector) -> void
33
+
34
+ def deselect_resolver: (Resolver::Resolver resolver, Selector selector) -> void
35
+
36
+ def try_clone_connection: (Connection connection, Selector selector, Integer? family) -> Connection
37
+
38
+ def find_connection: (http_uri request_uri, Selector selector, Options options) -> Connection
39
+
40
+ private
19
41
 
20
42
  def initialize: (?options) { (self) -> void } -> void
21
43
  | (?options) -> void
22
44
 
23
- private
45
+ def deactivate: (Selector selector) -> void
24
46
 
25
- def pool: -> Pool
26
47
  def on_response: (Request, response) -> void
27
- def on_promise: (untyped, untyped) -> void
28
- def fetch_response: (Request request, Array[Connection] connections, untyped options) -> response?
29
48
 
30
- def find_connection: (Request request, Array[Connection] connections, Options options) -> Connection
49
+ def on_promise: (untyped, untyped) -> void
31
50
 
32
- def send_request: (Request request, Array[Connection] connections, ?Options options) -> void
51
+ def fetch_response: (Request request, Selector selector, Options options) -> response?
33
52
 
34
- def set_connection_callbacks: (Connection connection, Array[Connection] connections, Options options, ?cloned: bool) -> void
53
+ def send_request: (Request request, Selector selector, ?Options options) -> void
35
54
 
36
55
  def set_request_callbacks: (Request request) -> void
37
56
 
38
- def build_altsvc_connection: (Connection existing_connection, Array[Connection] connections, URI::Generic alt_origin, String origin, Hash[String, String] alt_params, Options options) -> (Connection & AltSvc::ConnectionMixin)?
39
-
40
- def build_requests: (verb, uri, options) -> Array[Request]
41
- | (Array[[verb, uri, options]], options) -> Array[Request]
42
- | (Array[[verb, uri]], options) -> Array[Request]
43
- | (verb, _Each[[uri, options]], Options) -> Array[Request]
44
- | (verb, _Each[uri], options) -> Array[Request]
57
+ def build_requests: (verb, uri, request_params) -> Array[Request]
58
+ | (Array[[verb, uri, request_params]], Hash[Symbol, untyped]) -> Array[Request]
59
+ | (Array[[verb, uri]], request_params) -> Array[Request]
60
+ | (verb, _Each[[uri, request_params]], Hash[Symbol, untyped]) -> Array[Request]
61
+ | (verb, _Each[uri], request_params) -> Array[Request]
45
62
 
46
- def init_connection: (http_uri uri, Options options) -> Connection
63
+ def do_init_connection: (Connection connection, Selector selector) -> void
47
64
 
48
65
  def send_requests: (*Request) -> Array[response]
49
66
 
50
- def _send_requests: (Array[Request] requests) -> Array[Connection]
67
+ def _send_requests: (Array[Request] requests, Selector selector) -> void
68
+
69
+ def receive_requests: (Array[Request] requests, Selector selector) -> Array[response]
70
+
71
+ def resolve_connection: (Connection connection, Selector selector) -> void
72
+
73
+ def on_resolver_connection: (Connection connection, Selector selector) -> void
74
+
75
+ def on_resolver_close: (Resolver::Resolver resolver, Selector selector) -> void
76
+
77
+ def find_resolver_for: (Connection connection, Selector selector) -> (Resolver::Multi | Resolver::Resolver)
78
+
79
+ def coalesce_connections: (Connection conn1, Connection conn2, Selector selector, bool from_pool) -> bool
80
+
81
+ def get_current_selector: () -> Selector?
82
+ | () { () -> Selector } -> Selector
83
+
84
+ def set_current_selector: (Selector? selector) -> void
51
85
 
52
- def receive_requests: (Array[Request] requests, Array[Connection] connections) -> Array[response]
86
+ def selector_store: () -> Hash[instance, Selector]
53
87
 
54
88
  attr_reader self.default_options: Options
55
89
  end
data/sig/timers.rbs CHANGED
@@ -1,10 +1,12 @@
1
1
  module HTTPX
2
2
  class Timers
3
+ type callback = ^() -> void
4
+
3
5
  @intervals: Array[Interval]
4
6
  @next_interval_at: Float
5
7
 
6
- def after: (Numeric interval_in_secs, ^() -> void) -> Interval
7
- | (Numeric interval_in_secs) { () -> void } -> Interval
8
+ def after: (Numeric interval_in_secs, ^() -> void) -> Timer
9
+ | (Numeric interval_in_secs) { () -> void } -> Timer
8
10
 
9
11
  def wait_interval: () -> Numeric?
10
12
 
@@ -15,8 +17,6 @@ module HTTPX
15
17
  class Interval
16
18
  include Comparable
17
19
 
18
- type callback = ^() -> void
19
-
20
20
  attr_reader interval: Numeric
21
21
 
22
22
  @callbacks: Array[callback]
@@ -25,6 +25,8 @@ module HTTPX
25
25
 
26
26
  def on_empty: () { () -> void } -> void
27
27
 
28
+ def cancel: () -> void
29
+
28
30
  def to_f: () -> Float
29
31
 
30
32
  def <<: (callback) -> void
@@ -41,5 +43,14 @@ module HTTPX
41
43
 
42
44
  def initialize: (Numeric interval) -> void
43
45
  end
46
+
47
+ class Timer
48
+ @interval: Interval
49
+ @callback: callback
50
+
51
+ def initialize: (Interval interval, callback callback) -> void
52
+
53
+ def cancel: () -> void
54
+ end
44
55
  end
45
56
  end
@@ -4,10 +4,8 @@ module HTTPX
4
4
  class Error < HTTPX::Error
5
5
  end
6
6
 
7
- class Encoder
8
- extend Forwardable
9
-
10
- @raw: bodyIO
7
+ class Encoder # < SimpleDelegator
8
+ @raw: Object & bodyIO
11
9
 
12
10
  def bytesize: () -> (Integer | Float)
13
11
 
@@ -8,7 +8,7 @@ module HTTPX::Transcoder
8
8
  def self?.encode: (_Each[String] chunks) -> Encoder
9
9
 
10
10
  class Encoder
11
- @raw: _Each[String]
11
+ @raw: Object & _Each[String]
12
12
 
13
13
  def each: () { (String) -> void } -> void
14
14
  | () -> Enumerator[String, void]
@@ -5,6 +5,7 @@ module HTTPX
5
5
  def self?.decode: (Response body, ?bytesize: Integer) -> GZIP::Inflater
6
6
 
7
7
  class Deflater < Transcoder::Deflater
8
+ @deflater: Zlib::Deflate
8
9
  end
9
10
  end
10
11
  end
@@ -6,6 +6,8 @@ module HTTPX::Transcoder
6
6
  type urlencoded_input = Enumerable[[_ToS, form_nested_value | Multipart::multipart_nested_value]]
7
7
 
8
8
  module Form
9
+ PARAM_DEPTH_LIMIT: Integer
10
+
9
11
  def self?.encode: (urlencoded_input form) -> (Encoder | Multipart::Encoder)
10
12
  def self?.decode: (HTTPX::Response response) -> _Decoder
11
13
  def self?.multipart?: (form_nested_value | Multipart::multipart_nested_value data) -> bool
@@ -14,6 +16,8 @@ module HTTPX::Transcoder
14
16
  extend Forwardable
15
17
  include _ToS
16
18
 
19
+ @raw: String
20
+
17
21
  def bytesize: () -> Integer
18
22
 
19
23
  def content_type: () -> String
@@ -22,5 +26,9 @@ module HTTPX::Transcoder
22
26
 
23
27
  def initialize: (urlencoded_input form) -> untyped
24
28
  end
29
+
30
+ module Decoder
31
+ def self?.call: (HTTPX::Response response, *untyped) -> Hash[String, untyped]
32
+ end
25
33
  end
26
34
  end
@@ -1,7 +1,7 @@
1
1
  module HTTPX
2
2
  module Transcoder
3
3
  module GZIP
4
- def self?.encode: (_Encoder body) -> Deflater
4
+ def self?.encode: (body_encoder body) -> Deflater
5
5
  def self?.decode: (Response response, ?bytesize: Integer) -> Inflater
6
6
 
7
7
  class Deflater < Transcoder::Deflater
@@ -15,6 +15,9 @@ module HTTPX
15
15
  end
16
16
 
17
17
  class Inflater
18
+ @inflater: Zlib::Inflate
19
+ @bytesize: Integer
20
+
18
21
  def initialize: (Integer | Float bytesize) -> void
19
22
 
20
23
  def call: (String chunk) -> String
@@ -5,7 +5,7 @@ module HTTPX::Transcoder
5
5
  def self?.encode: (_ToJson json) -> Encoder
6
6
  def self?.decode: (HTTPX::Response response) -> _Decoder
7
7
 
8
- def self?.json_load: (string source, ?json_options) -> untyped
8
+ def self?.json_load: (string source, ?JSON::options) -> untyped
9
9
  def self?.json_dump: (_ToJson obj, *untyped) -> String
10
10
 
11
11
  class Encoder
@@ -9,7 +9,7 @@ module HTTPX
9
9
 
10
10
  MULTIPART_VALUE_COND: ^(_Reader | record_multipart_value value) -> bool
11
11
 
12
- type multipart_value = string | Pathname | File | _Reader
12
+ type multipart_value = string | Pathname | File | Tempfile | _Reader
13
13
 
14
14
  type record_multipart_value = { content_type: String, filename: String, body: multipart_value } |
15
15
  { content_type: String, body: multipart_value }
@@ -24,10 +24,12 @@ module HTTPX
24
24
  @form: Enumerable[[Symbol | string, Object & multipart_nested_value]]
25
25
  @parts: Array[Object & _Reader]
26
26
 
27
- def bytesize: () -> Integer
27
+ attr_reader bytesize: Integer
28
28
 
29
29
  def content_type: () -> String
30
30
 
31
+ def to_s: () -> String
32
+
31
33
  def read: (?int? length, ?string? buffer) -> String?
32
34
 
33
35
  def rewind: () -> void
@@ -81,13 +83,13 @@ module HTTPX
81
83
 
82
84
  module Part
83
85
  def self?.call: [U] (Object & _MultipartInput multipart_input) -> [U, String, String]
84
- | (Object & multipart_nested_value input) -> ([StringIO, String, String?] | [File, String, String])
86
+ | (multipart_nested_value value) -> ([StringIO, String, String?] | [File | Tempfile, String, String])
85
87
  end
86
88
 
87
89
  module MimeTypeDetector
88
90
  DEFAULT_MIMETYPE: String
89
91
 
90
- def self?.call: (::IO file, String filename) -> String?
92
+ def self?.call: (::IO | Tempfile file, String filename) -> String?
91
93
  end
92
94
  end
93
95
  end
@@ -1,13 +1,13 @@
1
1
  module HTTPX
2
2
  module Transcoder
3
3
  class BodyReader
4
- @body: _Reader | _Each[String]
4
+ @body: Object & (_Reader | _Each[String])
5
5
 
6
- def initialize: (bodyIO body) -> void
6
+ def initialize: (body_encoder body) -> void
7
7
 
8
8
  def bytesize: () -> (Integer | Float)
9
9
 
10
- def read: (?int? length, ?string outbuf) -> String?
10
+ def read: (?int? length, ?string? outbuf) -> String?
11
11
 
12
12
  def close: () -> void
13
13
  end
@@ -5,16 +5,15 @@ module HTTPX
5
5
 
6
6
  @body: BodyReader
7
7
  @buffer: Response::Buffer?
8
- @body: _Encoder | StringIO
9
8
  @closed: bool
10
9
 
11
10
  attr_reader content_type: String
12
11
 
13
- def initialize: (_Encoder body) -> void
12
+ def initialize: (body_encoder body) -> void
14
13
 
15
14
  def bytesize: () -> (Integer | Float)
16
15
 
17
- def read: (?int? length, ?string outbuf) -> String?
16
+ def read: (?int? length, ?string? outbuf) -> String?
18
17
 
19
18
  def close: () -> void
20
19
 
metadata CHANGED
@@ -1,29 +1,28 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: httpx
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.6
4
+ version: 1.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tiago Cardoso
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-06-17 00:00:00.000000000 Z
10
+ date: 2025-04-03 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
- name: http-2-next
13
+ name: http-2
15
14
  requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
16
  - - ">="
18
17
  - !ruby/object:Gem::Version
19
- version: 1.0.3
18
+ version: 1.0.0
20
19
  type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
23
  - - ">="
25
24
  - !ruby/object:Gem::Version
26
- version: 1.0.3
25
+ version: 1.0.0
27
26
  description: A client library for making HTTP requests from Ruby.
28
27
  email:
29
28
  - cardoso_tiago@hotmail.com
@@ -144,6 +143,16 @@ extra_rdoc_files:
144
143
  - doc/release_notes/1_2_4.md
145
144
  - doc/release_notes/1_2_5.md
146
145
  - doc/release_notes/1_2_6.md
146
+ - doc/release_notes/1_3_0.md
147
+ - doc/release_notes/1_3_1.md
148
+ - doc/release_notes/1_3_2.md
149
+ - doc/release_notes/1_3_3.md
150
+ - doc/release_notes/1_3_4.md
151
+ - doc/release_notes/1_4_0.md
152
+ - doc/release_notes/1_4_1.md
153
+ - doc/release_notes/1_4_2.md
154
+ - doc/release_notes/1_4_3.md
155
+ - doc/release_notes/1_4_4.md
147
156
  files:
148
157
  - LICENSE.txt
149
158
  - README.md
@@ -259,6 +268,16 @@ files:
259
268
  - doc/release_notes/1_2_4.md
260
269
  - doc/release_notes/1_2_5.md
261
270
  - doc/release_notes/1_2_6.md
271
+ - doc/release_notes/1_3_0.md
272
+ - doc/release_notes/1_3_1.md
273
+ - doc/release_notes/1_3_2.md
274
+ - doc/release_notes/1_3_3.md
275
+ - doc/release_notes/1_3_4.md
276
+ - doc/release_notes/1_4_0.md
277
+ - doc/release_notes/1_4_1.md
278
+ - doc/release_notes/1_4_2.md
279
+ - doc/release_notes/1_4_3.md
280
+ - doc/release_notes/1_4_4.md
262
281
  - lib/httpx.rb
263
282
  - lib/httpx/adapters/datadog.rb
264
283
  - lib/httpx/adapters/faraday.rb
@@ -297,6 +316,7 @@ files:
297
316
  - lib/httpx/plugins/circuit_breaker.rb
298
317
  - lib/httpx/plugins/circuit_breaker/circuit.rb
299
318
  - lib/httpx/plugins/circuit_breaker/circuit_store.rb
319
+ - lib/httpx/plugins/content_digest.rb
300
320
  - lib/httpx/plugins/cookies.rb
301
321
  - lib/httpx/plugins/cookies/cookie.rb
302
322
  - lib/httpx/plugins/cookies/jar.rb
@@ -329,6 +349,7 @@ files:
329
349
  - lib/httpx/plugins/upgrade.rb
330
350
  - lib/httpx/plugins/upgrade/h2.rb
331
351
  - lib/httpx/plugins/webdav.rb
352
+ - lib/httpx/plugins/xml.rb
332
353
  - lib/httpx/pmatch_extensions.rb
333
354
  - lib/httpx/pool.rb
334
355
  - lib/httpx/punycode.rb
@@ -345,7 +366,6 @@ files:
345
366
  - lib/httpx/response/buffer.rb
346
367
  - lib/httpx/selector.rb
347
368
  - lib/httpx/session.rb
348
- - lib/httpx/session2.rb
349
369
  - lib/httpx/session_extensions.rb
350
370
  - lib/httpx/timers.rb
351
371
  - lib/httpx/transcoder.rb
@@ -362,8 +382,6 @@ files:
362
382
  - lib/httpx/transcoder/multipart/part.rb
363
383
  - lib/httpx/transcoder/utils/body_reader.rb
364
384
  - lib/httpx/transcoder/utils/deflater.rb
365
- - lib/httpx/transcoder/utils/inflater.rb
366
- - lib/httpx/transcoder/xml.rb
367
385
  - lib/httpx/utils.rb
368
386
  - lib/httpx/version.rb
369
387
  - sig/altsvc.rbs
@@ -397,6 +415,7 @@ files:
397
415
  - sig/plugins/callbacks.rbs
398
416
  - sig/plugins/circuit_breaker.rbs
399
417
  - sig/plugins/compression.rbs
418
+ - sig/plugins/content_digest.rbs
400
419
  - sig/plugins/cookies.rbs
401
420
  - sig/plugins/cookies/cookie.rbs
402
421
  - sig/plugins/cookies/jar.rbs
@@ -420,8 +439,11 @@ files:
420
439
  - sig/plugins/rate_limiter.rbs
421
440
  - sig/plugins/response_cache.rbs
422
441
  - sig/plugins/retries.rbs
442
+ - sig/plugins/ssrf_filter.rbs
423
443
  - sig/plugins/stream.rbs
424
444
  - sig/plugins/upgrade.rbs
445
+ - sig/plugins/webdav.rbs
446
+ - sig/plugins/xml.rbs
425
447
  - sig/pool.rbs
426
448
  - sig/request.rbs
427
449
  - sig/request/body.rbs
@@ -447,8 +469,6 @@ files:
447
469
  - sig/transcoder/multipart.rbs
448
470
  - sig/transcoder/utils/body_reader.rbs
449
471
  - sig/transcoder/utils/deflater.rbs
450
- - sig/transcoder/utils/inflater.rbs
451
- - sig/transcoder/xml.rbs
452
472
  - sig/utils.rbs
453
473
  homepage: https://gitlab.com/os85/httpx
454
474
  licenses:
@@ -460,7 +480,6 @@ metadata:
460
480
  source_code_uri: https://gitlab.com/os85/httpx
461
481
  homepage_uri: https://honeyryderchuck.gitlab.io/httpx/
462
482
  rubygems_mfa_required: 'true'
463
- post_install_message:
464
483
  rdoc_options: []
465
484
  require_paths:
466
485
  - lib
@@ -475,8 +494,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
475
494
  - !ruby/object:Gem::Version
476
495
  version: '0'
477
496
  requirements: []
478
- rubygems_version: 3.5.3
479
- signing_key:
497
+ rubygems_version: 3.6.2
480
498
  specification_version: 4
481
499
  summary: HTTPX, to the future, and beyond
482
500
  test_files: []
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "session"
4
- module HTTPX
5
- class Session
6
- def initialize(options = EMPTY_HASH, &blk)
7
- @options = self.class.default_options.merge(options)
8
- @responses = {}
9
- @persistent = @options.persistent
10
- wrap(&blk) if blk
11
- end
12
-
13
- def wrap
14
- begin
15
- prev_persistent = @persistent
16
- @persistent = true
17
- yield self
18
- ensure
19
- @persistent = prev_persistent
20
- end
21
- end
22
- end
23
- end
@@ -1,19 +0,0 @@
1
- module HTTPX
2
- module Transcoder
3
- class Inflater
4
- def initialize(bytesize)
5
- @bytesize = bytesize
6
- end
7
-
8
- def call(chunk)
9
- buffer = @inflater.inflate(chunk)
10
- @bytesize -= chunk.bytesize
11
- if @bytesize <= 0
12
- buffer << @inflater.finish
13
- @inflater.close
14
- end
15
- buffer
16
- end
17
- end
18
- end
19
- end
@@ -1,52 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "delegate"
4
- require "forwardable"
5
- require "uri"
6
-
7
- module HTTPX::Transcoder
8
- module Xml
9
- module_function
10
-
11
- MIME_TYPES = %r{\b(application|text)/(.+\+)?xml\b}.freeze
12
-
13
- class Encoder
14
- def initialize(xml)
15
- @raw = xml
16
- end
17
-
18
- def content_type
19
- charset = @raw.respond_to?(:encoding) ? @raw.encoding.to_s.downcase : "utf-8"
20
- "application/xml; charset=#{charset}"
21
- end
22
-
23
- def bytesize
24
- @raw.to_s.bytesize
25
- end
26
-
27
- def to_s
28
- @raw.to_s
29
- end
30
- end
31
-
32
- def encode(xml)
33
- Encoder.new(xml)
34
- end
35
-
36
- begin
37
- require "nokogiri"
38
-
39
- def decode(response)
40
- content_type = response.content_type.mime_type
41
-
42
- raise HTTPX::Error, "invalid form mime type (#{content_type})" unless MIME_TYPES.match?(content_type)
43
-
44
- Nokogiri::XML.method(:parse)
45
- end
46
- rescue LoadError
47
- def decode(_response)
48
- raise HTTPX::Error, "\"nokogiri\" is required in order to decode XML"
49
- end
50
- end
51
- end
52
- end
@@ -1,12 +0,0 @@
1
- module HTTPX
2
- module Transcoder
3
- class Inflater
4
- @inflater: Zlib::Inflate
5
- @bytesize: Integer
6
-
7
- def initialize: (Integer | Float bytesize) -> void
8
-
9
- def call: (String chunk) -> String
10
- end
11
- end
12
- end