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.
- checksums.yaml +4 -4
- data/README.md +1 -2
- data/doc/release_notes/1_3_0.md +18 -0
- data/doc/release_notes/1_3_1.md +17 -0
- data/doc/release_notes/1_3_2.md +6 -0
- data/doc/release_notes/1_3_3.md +5 -0
- data/doc/release_notes/1_3_4.md +6 -0
- data/doc/release_notes/1_4_0.md +43 -0
- data/doc/release_notes/1_4_1.md +19 -0
- data/doc/release_notes/1_4_2.md +20 -0
- data/doc/release_notes/1_4_3.md +11 -0
- data/doc/release_notes/1_4_4.md +14 -0
- data/lib/httpx/adapters/datadog.rb +56 -80
- data/lib/httpx/adapters/faraday.rb +5 -2
- data/lib/httpx/adapters/webmock.rb +24 -8
- data/lib/httpx/callbacks.rb +2 -7
- data/lib/httpx/chainable.rb +3 -1
- data/lib/httpx/connection/http1.rb +11 -7
- data/lib/httpx/connection/http2.rb +57 -34
- data/lib/httpx/connection.rb +270 -71
- data/lib/httpx/errors.rb +15 -4
- data/lib/httpx/io/ssl.rb +6 -3
- data/lib/httpx/io/tcp.rb +1 -1
- data/lib/httpx/io/unix.rb +1 -1
- data/lib/httpx/loggable.rb +17 -10
- data/lib/httpx/options.rb +30 -23
- data/lib/httpx/plugins/aws_sdk_authentication.rb +3 -0
- data/lib/httpx/plugins/aws_sigv4.rb +36 -17
- data/lib/httpx/plugins/callbacks.rb +13 -2
- data/lib/httpx/plugins/circuit_breaker.rb +11 -5
- data/lib/httpx/plugins/content_digest.rb +202 -0
- data/lib/httpx/plugins/cookies.rb +9 -6
- data/lib/httpx/plugins/digest_auth.rb +3 -0
- data/lib/httpx/plugins/expect.rb +10 -4
- data/lib/httpx/plugins/follow_redirects.rb +68 -33
- data/lib/httpx/plugins/grpc/grpc_encoding.rb +2 -0
- data/lib/httpx/plugins/grpc.rb +2 -2
- data/lib/httpx/plugins/h2c.rb +23 -20
- data/lib/httpx/plugins/internal_telemetry.rb +48 -1
- data/lib/httpx/plugins/oauth.rb +1 -1
- data/lib/httpx/plugins/persistent.rb +16 -0
- data/lib/httpx/plugins/proxy/http.rb +19 -16
- data/lib/httpx/plugins/proxy/socks4.rb +1 -1
- data/lib/httpx/plugins/proxy/socks5.rb +1 -1
- data/lib/httpx/plugins/proxy.rb +96 -85
- data/lib/httpx/plugins/retries.rb +28 -10
- data/lib/httpx/plugins/ssrf_filter.rb +4 -1
- data/lib/httpx/plugins/stream.rb +42 -18
- data/lib/httpx/plugins/upgrade.rb +5 -10
- data/lib/httpx/plugins/webdav.rb +6 -0
- data/lib/httpx/plugins/xml.rb +76 -0
- data/lib/httpx/pool.rb +73 -244
- data/lib/httpx/request/body.rb +50 -55
- data/lib/httpx/request.rb +77 -14
- data/lib/httpx/resolver/https.rb +17 -20
- data/lib/httpx/resolver/multi.rb +34 -16
- data/lib/httpx/resolver/native.rb +140 -61
- data/lib/httpx/resolver/resolver.rb +64 -19
- data/lib/httpx/resolver/system.rb +32 -16
- data/lib/httpx/resolver.rb +21 -14
- data/lib/httpx/response/body.rb +12 -1
- data/lib/httpx/response.rb +16 -9
- data/lib/httpx/selector.rb +170 -91
- data/lib/httpx/session.rb +282 -139
- data/lib/httpx/timers.rb +17 -2
- data/lib/httpx/transcoder/body.rb +15 -29
- data/lib/httpx/transcoder/form.rb +2 -0
- data/lib/httpx/transcoder/gzip.rb +0 -3
- data/lib/httpx/transcoder/json.rb +16 -2
- data/lib/httpx/transcoder/multipart/encoder.rb +11 -2
- data/lib/httpx/transcoder/multipart/part.rb +1 -1
- data/lib/httpx/transcoder/utils/deflater.rb +7 -4
- data/lib/httpx/transcoder.rb +0 -1
- data/lib/httpx/version.rb +1 -1
- data/lib/httpx.rb +20 -21
- data/sig/callbacks.rbs +2 -3
- data/sig/chainable.rbs +6 -2
- data/sig/connection/http1.rbs +2 -2
- data/sig/connection/http2.rbs +22 -18
- data/sig/connection.rbs +40 -9
- data/sig/errors.rbs +9 -3
- data/sig/httpx.rbs +3 -3
- data/sig/io/tcp.rbs +1 -1
- data/sig/io/unix.rbs +1 -1
- data/sig/loggable.rbs +4 -2
- data/sig/options.rbs +8 -13
- data/sig/plugins/aws_sigv4.rbs +8 -2
- data/sig/plugins/content_digest.rbs +51 -0
- data/sig/plugins/cookies/cookie.rbs +9 -0
- data/sig/plugins/follow_redirects.rbs +1 -1
- data/sig/plugins/grpc/call.rbs +4 -0
- data/sig/plugins/persistent.rbs +4 -1
- data/sig/plugins/proxy/http.rbs +3 -0
- data/sig/plugins/proxy/socks5.rbs +11 -3
- data/sig/plugins/proxy.rbs +18 -9
- data/sig/plugins/push_promise.rbs +6 -3
- data/sig/plugins/rate_limiter.rbs +2 -0
- data/sig/plugins/retries.rbs +1 -1
- data/sig/plugins/ssrf_filter.rbs +26 -0
- data/sig/plugins/stream.rbs +3 -0
- data/sig/plugins/webdav.rbs +23 -0
- data/sig/plugins/xml.rbs +37 -0
- data/sig/pool.rbs +27 -33
- data/sig/request/body.rbs +4 -10
- data/sig/request.rbs +14 -1
- data/sig/resolver/multi.rbs +26 -1
- data/sig/resolver/native.rbs +6 -3
- data/sig/resolver/resolver.rbs +22 -3
- data/sig/resolver.rbs +5 -1
- data/sig/response/body.rbs +2 -2
- data/sig/response/buffer.rbs +2 -2
- data/sig/response.rbs +9 -4
- data/sig/selector.rbs +31 -4
- data/sig/session.rbs +54 -20
- data/sig/timers.rbs +15 -4
- data/sig/transcoder/body.rbs +2 -4
- data/sig/transcoder/chunker.rbs +1 -1
- data/sig/transcoder/deflate.rbs +1 -0
- data/sig/transcoder/form.rbs +8 -0
- data/sig/transcoder/gzip.rbs +4 -1
- data/sig/transcoder/json.rbs +1 -1
- data/sig/transcoder/multipart.rbs +6 -4
- data/sig/transcoder/utils/body_reader.rbs +3 -3
- data/sig/transcoder/utils/deflater.rbs +2 -3
- metadata +32 -14
- data/lib/httpx/session2.rb +0 -23
- data/lib/httpx/transcoder/utils/inflater.rb +0 -19
- data/lib/httpx/transcoder/xml.rb +0 -52
- data/sig/transcoder/utils/inflater.rbs +0 -12
- 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: (?
|
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
|
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
|
-
|
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
|
32
|
+
def deregister: (selectable io) -> selectable?
|
13
33
|
|
14
34
|
private
|
15
35
|
|
16
|
-
def initialize: () ->
|
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
|
-
|
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: (
|
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
|
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
|
-
|
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
|
49
|
+
def on_promise: (untyped, untyped) -> void
|
31
50
|
|
32
|
-
def
|
51
|
+
def fetch_response: (Request request, Selector selector, Options options) -> response?
|
33
52
|
|
34
|
-
def
|
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
|
39
|
-
|
40
|
-
|
41
|
-
| (
|
42
|
-
| (
|
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
|
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) ->
|
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
|
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) ->
|
7
|
-
| (Numeric interval_in_secs) { () -> void } ->
|
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
|
data/sig/transcoder/body.rbs
CHANGED
data/sig/transcoder/chunker.rbs
CHANGED
data/sig/transcoder/deflate.rbs
CHANGED
data/sig/transcoder/form.rbs
CHANGED
@@ -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
|
data/sig/transcoder/gzip.rbs
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module HTTPX
|
2
2
|
module Transcoder
|
3
3
|
module GZIP
|
4
|
-
def self?.encode: (
|
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
|
data/sig/transcoder/json.rbs
CHANGED
@@ -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, ?
|
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
|
-
|
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
|
-
| (
|
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: (
|
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: (
|
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.
|
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:
|
10
|
+
date: 2025-04-03 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
|
-
name: http-2
|
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.
|
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.
|
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.
|
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: []
|
data/lib/httpx/session2.rb
DELETED
@@ -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
|
data/lib/httpx/transcoder/xml.rb
DELETED
@@ -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
|