httpx 0.21.0 → 1.2.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.
- checksums.yaml +4 -4
- data/LICENSE.txt +0 -48
- data/README.md +54 -45
- data/doc/release_notes/0_10_0.md +2 -2
- data/doc/release_notes/0_11_0.md +3 -5
- data/doc/release_notes/0_12_0.md +5 -5
- data/doc/release_notes/0_13_0.md +4 -4
- data/doc/release_notes/0_14_0.md +2 -2
- data/doc/release_notes/0_16_0.md +3 -3
- data/doc/release_notes/0_17_0.md +1 -1
- data/doc/release_notes/0_18_0.md +4 -4
- data/doc/release_notes/0_18_2.md +1 -1
- data/doc/release_notes/0_19_0.md +1 -1
- data/doc/release_notes/0_20_0.md +1 -1
- data/doc/release_notes/0_21_0.md +7 -5
- data/doc/release_notes/0_21_1.md +12 -0
- data/doc/release_notes/0_22_0.md +13 -0
- data/doc/release_notes/0_22_1.md +11 -0
- data/doc/release_notes/0_22_2.md +5 -0
- data/doc/release_notes/0_22_3.md +55 -0
- data/doc/release_notes/0_22_4.md +6 -0
- data/doc/release_notes/0_22_5.md +6 -0
- data/doc/release_notes/0_23_0.md +42 -0
- data/doc/release_notes/0_23_1.md +5 -0
- data/doc/release_notes/0_23_2.md +5 -0
- data/doc/release_notes/0_23_3.md +6 -0
- data/doc/release_notes/0_23_4.md +5 -0
- data/doc/release_notes/0_24_0.md +48 -0
- data/doc/release_notes/0_24_1.md +12 -0
- data/doc/release_notes/0_24_2.md +12 -0
- data/doc/release_notes/0_24_3.md +12 -0
- data/doc/release_notes/0_24_4.md +18 -0
- data/doc/release_notes/0_24_5.md +6 -0
- data/doc/release_notes/0_24_6.md +5 -0
- data/doc/release_notes/0_24_7.md +10 -0
- data/doc/release_notes/1_0_0.md +60 -0
- data/doc/release_notes/1_0_1.md +5 -0
- data/doc/release_notes/1_0_2.md +7 -0
- data/doc/release_notes/1_1_0.md +32 -0
- data/doc/release_notes/1_1_1.md +17 -0
- data/doc/release_notes/1_1_2.md +12 -0
- data/doc/release_notes/1_1_3.md +18 -0
- data/doc/release_notes/1_1_4.md +6 -0
- data/doc/release_notes/1_1_5.md +12 -0
- data/doc/release_notes/1_2_0.md +49 -0
- data/doc/release_notes/1_2_1.md +6 -0
- data/lib/httpx/adapters/datadog.rb +100 -106
- data/lib/httpx/adapters/faraday.rb +143 -107
- data/lib/httpx/adapters/sentry.rb +26 -7
- data/lib/httpx/adapters/webmock.rb +33 -17
- data/lib/httpx/altsvc.rb +61 -24
- data/lib/httpx/base64.rb +27 -0
- data/lib/httpx/buffer.rb +12 -0
- data/lib/httpx/callbacks.rb +5 -3
- data/lib/httpx/chainable.rb +54 -39
- data/lib/httpx/connection/http1.rb +62 -37
- data/lib/httpx/connection/http2.rb +16 -27
- data/lib/httpx/connection.rb +213 -120
- data/lib/httpx/domain_name.rb +10 -13
- data/lib/httpx/errors.rb +34 -2
- data/lib/httpx/extensions.rb +4 -134
- data/lib/httpx/io/ssl.rb +77 -71
- data/lib/httpx/io/tcp.rb +46 -70
- data/lib/httpx/io/udp.rb +18 -52
- data/lib/httpx/io/unix.rb +6 -13
- data/lib/httpx/io.rb +3 -9
- data/lib/httpx/loggable.rb +4 -19
- data/lib/httpx/options.rb +168 -110
- data/lib/httpx/plugins/{authentication → auth}/basic.rb +1 -5
- data/lib/httpx/plugins/{authentication → auth}/digest.rb +13 -14
- data/lib/httpx/plugins/{authentication → auth}/ntlm.rb +1 -3
- data/lib/httpx/plugins/{authentication → auth}/socks5.rb +0 -2
- data/lib/httpx/plugins/auth.rb +25 -0
- data/lib/httpx/plugins/aws_sdk_authentication.rb +1 -3
- data/lib/httpx/plugins/aws_sigv4.rb +5 -6
- data/lib/httpx/plugins/basic_auth.rb +29 -0
- data/lib/httpx/plugins/brotli.rb +50 -0
- data/lib/httpx/plugins/callbacks.rb +91 -0
- data/lib/httpx/plugins/circuit_breaker/circuit.rb +40 -16
- data/lib/httpx/plugins/circuit_breaker/circuit_store.rb +14 -5
- data/lib/httpx/plugins/circuit_breaker.rb +30 -7
- data/lib/httpx/plugins/cookies/set_cookie_parser.rb +0 -2
- data/lib/httpx/plugins/cookies.rb +20 -10
- data/lib/httpx/plugins/{digest_authentication.rb → digest_auth.rb} +11 -12
- data/lib/httpx/plugins/expect.rb +15 -13
- data/lib/httpx/plugins/follow_redirects.rb +71 -29
- data/lib/httpx/plugins/grpc/call.rb +2 -3
- data/lib/httpx/plugins/grpc/grpc_encoding.rb +88 -0
- data/lib/httpx/plugins/grpc/message.rb +7 -37
- data/lib/httpx/plugins/grpc.rb +35 -29
- data/lib/httpx/plugins/h2c.rb +25 -18
- data/lib/httpx/plugins/internal_telemetry.rb +16 -0
- data/lib/httpx/plugins/{ntlm_authentication.rb → ntlm_auth.rb} +7 -5
- data/lib/httpx/plugins/oauth.rb +170 -0
- data/lib/httpx/plugins/persistent.rb +1 -1
- data/lib/httpx/plugins/proxy/http.rb +15 -10
- data/lib/httpx/plugins/proxy/socks4.rb +8 -6
- data/lib/httpx/plugins/proxy/socks5.rb +10 -8
- data/lib/httpx/plugins/proxy.rb +69 -67
- data/lib/httpx/plugins/push_promise.rb +1 -1
- data/lib/httpx/plugins/rate_limiter.rb +3 -1
- data/lib/httpx/plugins/response_cache/file_store.rb +40 -0
- data/lib/httpx/plugins/response_cache/store.rb +34 -17
- data/lib/httpx/plugins/response_cache.rb +6 -6
- data/lib/httpx/plugins/retries.rb +61 -12
- data/lib/httpx/plugins/ssrf_filter.rb +142 -0
- data/lib/httpx/plugins/stream.rb +27 -32
- data/lib/httpx/plugins/upgrade/h2.rb +4 -4
- data/lib/httpx/plugins/upgrade.rb +8 -10
- data/lib/httpx/plugins/webdav.rb +10 -8
- data/lib/httpx/pool.rb +85 -23
- data/lib/httpx/punycode.rb +9 -291
- data/lib/httpx/request/body.rb +158 -0
- data/lib/httpx/request.rb +86 -121
- data/lib/httpx/resolver/https.rb +54 -17
- data/lib/httpx/resolver/multi.rb +8 -12
- data/lib/httpx/resolver/native.rb +163 -70
- data/lib/httpx/resolver/resolver.rb +28 -13
- data/lib/httpx/resolver/system.rb +15 -10
- data/lib/httpx/resolver.rb +38 -16
- data/lib/httpx/response/body.rb +242 -0
- data/lib/httpx/response/buffer.rb +96 -0
- data/lib/httpx/response.rb +113 -211
- data/lib/httpx/selector.rb +2 -4
- data/lib/httpx/session.rb +91 -64
- data/lib/httpx/session_extensions.rb +4 -1
- data/lib/httpx/timers.rb +28 -8
- data/lib/httpx/transcoder/body.rb +0 -2
- data/lib/httpx/transcoder/chunker.rb +0 -1
- data/lib/httpx/transcoder/deflate.rb +37 -0
- data/lib/httpx/transcoder/form.rb +52 -33
- data/lib/httpx/transcoder/gzip.rb +74 -0
- data/lib/httpx/transcoder/json.rb +2 -5
- data/lib/httpx/transcoder/multipart/decoder.rb +139 -0
- data/lib/httpx/{plugins → transcoder}/multipart/encoder.rb +3 -3
- data/lib/httpx/{plugins → transcoder}/multipart/mime_type_detector.rb +1 -1
- data/lib/httpx/{plugins → transcoder}/multipart/part.rb +3 -2
- data/lib/httpx/transcoder/multipart.rb +17 -0
- data/lib/httpx/transcoder/utils/body_reader.rb +46 -0
- data/lib/httpx/transcoder/utils/deflater.rb +72 -0
- data/lib/httpx/transcoder/utils/inflater.rb +19 -0
- data/lib/httpx/transcoder/xml.rb +0 -5
- data/lib/httpx/transcoder.rb +4 -6
- data/lib/httpx/utils.rb +36 -16
- data/lib/httpx/version.rb +1 -1
- data/lib/httpx.rb +12 -14
- data/sig/altsvc.rbs +33 -0
- data/sig/buffer.rbs +1 -0
- data/sig/callbacks.rbs +3 -3
- data/sig/chainable.rbs +10 -9
- data/sig/connection/http1.rbs +5 -4
- data/sig/connection/http2.rbs +1 -1
- data/sig/connection.rbs +46 -24
- data/sig/errors.rbs +9 -3
- data/sig/httpx.rbs +5 -4
- data/sig/io/ssl.rbs +26 -0
- data/sig/io/tcp.rbs +60 -0
- data/sig/io/udp.rbs +20 -0
- data/sig/io/unix.rbs +10 -0
- data/sig/options.rbs +28 -12
- data/sig/plugins/{authentication → auth}/basic.rbs +0 -2
- data/sig/plugins/{authentication → auth}/digest.rbs +2 -1
- data/sig/plugins/auth.rbs +13 -0
- data/sig/plugins/{basic_authentication.rbs → basic_auth.rbs} +2 -2
- data/sig/plugins/brotli.rbs +22 -0
- data/sig/plugins/callbacks.rbs +38 -0
- data/sig/plugins/circuit_breaker.rbs +13 -3
- data/sig/plugins/compression.rbs +6 -4
- data/sig/plugins/cookies/jar.rbs +2 -2
- data/sig/plugins/cookies.rbs +2 -0
- data/sig/plugins/{digest_authentication.rbs → digest_auth.rbs} +2 -2
- data/sig/plugins/follow_redirects.rbs +11 -2
- data/sig/plugins/grpc/call.rbs +19 -0
- data/sig/plugins/grpc/grpc_encoding.rbs +37 -0
- data/sig/plugins/grpc/message.rbs +17 -0
- data/sig/plugins/grpc.rbs +2 -32
- data/sig/plugins/h2c.rbs +1 -1
- data/sig/plugins/{ntlm_authentication.rbs → ntlm_auth.rbs} +2 -2
- data/sig/plugins/oauth.rbs +54 -0
- data/sig/plugins/proxy/socks4.rbs +4 -4
- data/sig/plugins/proxy/socks5.rbs +2 -2
- data/sig/plugins/proxy/ssh.rbs +1 -1
- data/sig/plugins/proxy.rbs +10 -4
- data/sig/plugins/response_cache.rbs +12 -3
- data/sig/plugins/retries.rbs +28 -8
- data/sig/plugins/stream.rbs +24 -17
- data/sig/plugins/upgrade.rbs +5 -3
- data/sig/pool.rbs +5 -4
- data/sig/request/body.rbs +40 -0
- data/sig/request.rbs +12 -28
- data/sig/resolver/https.rbs +7 -2
- data/sig/resolver/native.rbs +10 -4
- data/sig/resolver/resolver.rbs +6 -4
- data/sig/resolver/system.rbs +2 -0
- data/sig/resolver.rbs +9 -5
- data/sig/response/body.rbs +53 -0
- data/sig/response/buffer.rbs +24 -0
- data/sig/response.rbs +17 -38
- data/sig/session.rbs +24 -18
- data/sig/timers.rbs +17 -7
- data/sig/transcoder/body.rbs +4 -3
- data/sig/transcoder/deflate.rbs +11 -0
- data/sig/transcoder/form.rbs +5 -3
- data/sig/transcoder/gzip.rbs +24 -0
- data/sig/transcoder/json.rbs +4 -2
- data/sig/{plugins → transcoder}/multipart.rbs +3 -12
- data/sig/transcoder/utils/body_reader.rbs +15 -0
- data/sig/transcoder/utils/deflater.rbs +29 -0
- data/sig/transcoder/utils/inflater.rbs +12 -0
- data/sig/transcoder/xml.rbs +1 -1
- data/sig/transcoder.rbs +22 -7
- data/sig/utils.rbs +2 -0
- metadata +127 -40
- data/lib/httpx/plugins/authentication.rb +0 -20
- data/lib/httpx/plugins/basic_authentication.rb +0 -30
- data/lib/httpx/plugins/compression/brotli.rb +0 -54
- data/lib/httpx/plugins/compression/deflate.rb +0 -49
- data/lib/httpx/plugins/compression/gzip.rb +0 -88
- data/lib/httpx/plugins/compression.rb +0 -164
- data/lib/httpx/plugins/multipart/decoder.rb +0 -187
- data/lib/httpx/plugins/multipart.rb +0 -84
- data/lib/httpx/registry.rb +0 -85
- data/sig/plugins/authentication.rbs +0 -11
- data/sig/plugins/compression/brotli.rbs +0 -21
- data/sig/plugins/compression/deflate.rbs +0 -17
- data/sig/plugins/compression/gzip.rbs +0 -29
- data/sig/registry.rbs +0 -13
- /data/sig/plugins/{authentication → auth}/ntlm.rbs +0 -0
- /data/sig/plugins/{authentication → auth}/socks5.rbs +0 -0
data/sig/resolver/resolver.rbs
CHANGED
|
@@ -6,8 +6,6 @@ module HTTPX
|
|
|
6
6
|
|
|
7
7
|
RECORD_TYPES: Hash[Integer, singleton(Resolv::DNS::Resource)]
|
|
8
8
|
|
|
9
|
-
attr_reader family: ip_family
|
|
10
|
-
|
|
11
9
|
@record_type: singleton(Resolv::DNS::Resource)
|
|
12
10
|
@options: Options
|
|
13
11
|
@resolver_options: Hash[Symbol, untyped]
|
|
@@ -16,21 +14,25 @@ module HTTPX
|
|
|
16
14
|
|
|
17
15
|
def close: () -> void
|
|
18
16
|
|
|
17
|
+
alias terminate close
|
|
18
|
+
|
|
19
19
|
def closed?: () -> bool
|
|
20
20
|
|
|
21
21
|
def empty?: () -> bool
|
|
22
22
|
|
|
23
|
-
def emit_addresses: (Connection connection, ip_family family, Array[IPAddr]) -> void
|
|
23
|
+
def emit_addresses: (Connection connection, ip_family family, Array[IPAddr], ?bool early_resolve) -> void
|
|
24
24
|
|
|
25
25
|
private
|
|
26
26
|
|
|
27
|
+
def emit_resolved_connection: (Connection connection, Array[IPAddr] addresses, bool early_resolve) -> void
|
|
28
|
+
|
|
27
29
|
def initialize: (ip_family? family, options options) -> void
|
|
28
30
|
|
|
29
31
|
def early_resolve: (Connection connection, ?hostname: String) -> void
|
|
30
32
|
|
|
31
33
|
def emit_resolve_error: (Connection connection, ?String hostname, ?StandardError) -> void
|
|
32
34
|
|
|
33
|
-
def resolve_error: (String hostname, ?StandardError?) -> ResolveError
|
|
35
|
+
def resolve_error: (String hostname, ?StandardError?) -> (ResolveError | ResolveTimeoutError)
|
|
34
36
|
end
|
|
35
37
|
end
|
|
36
38
|
end
|
data/sig/resolver/system.rbs
CHANGED
data/sig/resolver.rbs
CHANGED
|
@@ -2,9 +2,7 @@ module HTTPX
|
|
|
2
2
|
type ipaddr = IPAddr | String
|
|
3
3
|
|
|
4
4
|
module Resolver
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
RESOLVE_TIMEOUT: Integer | Float
|
|
5
|
+
RESOLVE_TIMEOUT: Array[Integer]
|
|
8
6
|
|
|
9
7
|
@lookup_mutex: Thread::Mutex
|
|
10
8
|
|
|
@@ -13,6 +11,7 @@ module HTTPX
|
|
|
13
11
|
type dns_result = { "name" => String, "TTL" => Numeric, "alias" => String }
|
|
14
12
|
| { "name" => String, "TTL" => Numeric, "data" => String }
|
|
15
13
|
|
|
14
|
+
type dns_decoding_response = [:ok, Array[dns_result]] | [:decode_error, Resolv::DNS::DecodeError] | [:dns_error, Integer] | Symbol
|
|
16
15
|
|
|
17
16
|
def nolookup_resolve: (String hostname) -> Array[IPAddr]
|
|
18
17
|
|
|
@@ -20,6 +19,11 @@ module HTTPX
|
|
|
20
19
|
|
|
21
20
|
def system_resolve: (String hostname) -> Array[IPAddr]?
|
|
22
21
|
|
|
22
|
+
def self?.resolver_for: (:native resolver_type) -> singleton(Native) |
|
|
23
|
+
(:system resolver_type) -> singleton(System) |
|
|
24
|
+
(:https resolver_type) -> singleton(HTTPS) |
|
|
25
|
+
[U] (U resolver_type) -> U
|
|
26
|
+
|
|
23
27
|
def self?.cached_lookup: (String hostname) -> Array[IPAddr]?
|
|
24
28
|
|
|
25
29
|
def self?.cached_lookup_set: (String hostname, ip_family family, Array[dns_result] addresses) -> void
|
|
@@ -28,8 +32,8 @@ module HTTPX
|
|
|
28
32
|
|
|
29
33
|
def self?.generate_id: () -> Integer
|
|
30
34
|
|
|
31
|
-
def self?.encode_dns_query: (String hostname, ?type: dns_resource) -> String
|
|
35
|
+
def self?.encode_dns_query: (String hostname, ?type: dns_resource, ?message_id: Integer) -> String
|
|
32
36
|
|
|
33
|
-
def self?.decode_dns_answer: (String) ->
|
|
37
|
+
def self?.decode_dns_answer: (String) -> dns_decoding_response
|
|
34
38
|
end
|
|
35
39
|
end
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
module HTTPX
|
|
2
|
+
class Response::Body
|
|
3
|
+
include _Reader
|
|
4
|
+
include _ToS
|
|
5
|
+
include _ToStr
|
|
6
|
+
|
|
7
|
+
attr_reader encoding: Encoding | String
|
|
8
|
+
attr_reader encodings: Array[Encoding | String]
|
|
9
|
+
|
|
10
|
+
@response: Response
|
|
11
|
+
@headers: Headers
|
|
12
|
+
@options: Options
|
|
13
|
+
@state: :idle | :memory | :buffer | :closed
|
|
14
|
+
@window_size: Integer
|
|
15
|
+
@length: Integer
|
|
16
|
+
@buffer: StringIO | Tempfile | nil
|
|
17
|
+
@reader: StringIO | Tempfile | nil
|
|
18
|
+
@inflaters: Array[Transcoder::_Inflater]
|
|
19
|
+
|
|
20
|
+
def initialize: (Response, Options) -> void
|
|
21
|
+
|
|
22
|
+
def closed?: () -> bool
|
|
23
|
+
|
|
24
|
+
def write:(String chunk) -> Integer?
|
|
25
|
+
|
|
26
|
+
def filename: () -> String?
|
|
27
|
+
|
|
28
|
+
def bytesize: () -> Integer
|
|
29
|
+
|
|
30
|
+
def each: () { (String) -> void } -> void
|
|
31
|
+
| () -> Enumerable[String]
|
|
32
|
+
|
|
33
|
+
def empty?: () -> bool
|
|
34
|
+
|
|
35
|
+
def copy_to: (String | File | _Writer destination) -> void
|
|
36
|
+
|
|
37
|
+
def close: () -> void
|
|
38
|
+
|
|
39
|
+
def rewind: () -> void
|
|
40
|
+
|
|
41
|
+
private
|
|
42
|
+
|
|
43
|
+
def initialize_inflaters: () -> void
|
|
44
|
+
|
|
45
|
+
def self.initialize_inflater_by_encoding: (Encoding | String encoding, Response response, ?bytesize: Integer) -> Transcoder::GZIP::Inflater
|
|
46
|
+
|
|
47
|
+
def decode_chunk: (String chunk) -> String
|
|
48
|
+
|
|
49
|
+
def transition: (Symbol nextstate) -> void
|
|
50
|
+
|
|
51
|
+
def _with_same_buffer_pos: [A] () { () -> A } -> A
|
|
52
|
+
end
|
|
53
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
module HTTPX
|
|
2
|
+
class Response::Buffer
|
|
3
|
+
@threshold_size: Integer
|
|
4
|
+
@bytesize: Integer
|
|
5
|
+
@encoding: Encoding
|
|
6
|
+
@buffer: StringIO | Tempfile
|
|
7
|
+
|
|
8
|
+
def initialize: (threshold_size: Integer, ?bytesize: Integer, ?encoding: Encoding | String) -> void
|
|
9
|
+
|
|
10
|
+
def size: () -> Integer
|
|
11
|
+
|
|
12
|
+
def write: (String) -> void
|
|
13
|
+
|
|
14
|
+
def to_s: () -> String
|
|
15
|
+
|
|
16
|
+
def close: () -> void
|
|
17
|
+
|
|
18
|
+
private
|
|
19
|
+
|
|
20
|
+
def try_upgrade_buffer: () -> void
|
|
21
|
+
|
|
22
|
+
def _with_same_buffer_pos: () { () -> void } -> void
|
|
23
|
+
end
|
|
24
|
+
end
|
data/sig/response.rbs
CHANGED
|
@@ -9,6 +9,7 @@ module HTTPX
|
|
|
9
9
|
|
|
10
10
|
class Response
|
|
11
11
|
extend Forwardable
|
|
12
|
+
include Callbacks
|
|
12
13
|
|
|
13
14
|
include _Response
|
|
14
15
|
include _ToS
|
|
@@ -24,58 +25,30 @@ module HTTPX
|
|
|
24
25
|
@content_type: ContentType
|
|
25
26
|
|
|
26
27
|
def copy_to: (_ToPath | _Writer destination) -> void
|
|
28
|
+
|
|
27
29
|
def close: () -> void
|
|
30
|
+
|
|
28
31
|
def uri: () -> URI::Generic
|
|
29
32
|
|
|
33
|
+
def peer_address: () -> ipaddr?
|
|
34
|
+
|
|
30
35
|
def merge_headers: (_Each[[String, headers_value]]) -> void
|
|
36
|
+
|
|
31
37
|
def bodyless?: () -> bool
|
|
38
|
+
|
|
32
39
|
def content_type: () -> ContentType
|
|
40
|
+
|
|
33
41
|
def complete?: () -> bool
|
|
34
42
|
|
|
35
43
|
def json: (?json_options opts) -> untyped
|
|
36
44
|
|
|
37
45
|
def form: () -> Hash[String, untyped]
|
|
38
46
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
def initialize: (Request request, String | Integer status, String version, headers?) -> untyped
|
|
42
|
-
def no_data?: () -> bool
|
|
43
|
-
|
|
44
|
-
def decode:(String format, ?untyped options) -> untyped
|
|
45
|
-
|
|
46
|
-
class Body
|
|
47
|
-
include _Reader
|
|
48
|
-
include _ToS
|
|
49
|
-
include _ToStr
|
|
47
|
+
def initialize: (Request request, String | Integer status, String version, headers?) -> void
|
|
50
48
|
|
|
51
|
-
|
|
52
|
-
@headers: Headers
|
|
53
|
-
@options: Options
|
|
54
|
-
@state: :idle | :memory | :buffer | :closed
|
|
55
|
-
@threshold_size: Integer
|
|
56
|
-
@window_size: Integer
|
|
57
|
-
@encoding: String
|
|
58
|
-
@length: Integer
|
|
59
|
-
@buffer: StringIO | Tempfile | nil
|
|
60
|
-
|
|
61
|
-
def write:(String chunk) -> Integer?
|
|
62
|
-
|
|
63
|
-
def each: () { (String) -> void } -> void
|
|
64
|
-
| () -> Enumerable[String]
|
|
65
|
-
|
|
66
|
-
def bytesize: () -> (Integer | Float)
|
|
67
|
-
def empty?: () -> bool
|
|
68
|
-
def copy_to: (String | File | _Writer destination) -> void
|
|
69
|
-
def close: () -> void
|
|
70
|
-
def closed?: () -> bool
|
|
71
|
-
|
|
72
|
-
private
|
|
49
|
+
private
|
|
73
50
|
|
|
74
|
-
|
|
75
|
-
def rewind: () -> void
|
|
76
|
-
def transition: () -> void
|
|
77
|
-
def _with_same_buffer_pos: [A] () { () -> A } -> A
|
|
78
|
-
end
|
|
51
|
+
def decode:(Transcoder::_Decode transcoder, ?untyped options) -> untyped
|
|
79
52
|
end
|
|
80
53
|
|
|
81
54
|
class ContentType
|
|
@@ -105,10 +78,16 @@ module HTTPX
|
|
|
105
78
|
|
|
106
79
|
attr_reader request: Request
|
|
107
80
|
|
|
81
|
+
attr_reader response: Response?
|
|
82
|
+
|
|
108
83
|
def status: () -> (Integer | _ToS)
|
|
109
84
|
|
|
110
85
|
def uri: () -> URI::Generic
|
|
111
86
|
|
|
87
|
+
def peer_address: () -> ipaddr?
|
|
88
|
+
|
|
89
|
+
def close: () -> void
|
|
90
|
+
|
|
112
91
|
private
|
|
113
92
|
|
|
114
93
|
def initialize: (Request, Exception, options) -> untyped
|
data/sig/session.rbs
CHANGED
|
@@ -11,42 +11,48 @@ module HTTPX
|
|
|
11
11
|
|
|
12
12
|
def self.plugin: (Symbol | Module plugin, ?options? options) ?{ (Class) -> void } -> singleton(Session)
|
|
13
13
|
|
|
14
|
-
def self.default_options: -> Options
|
|
15
|
-
|
|
16
14
|
def wrap: () { (instance) -> void } -> void
|
|
17
15
|
|
|
18
16
|
def close: (*untyped) -> void
|
|
19
17
|
|
|
20
|
-
def build_request: (
|
|
18
|
+
def build_request: (verb, generic_uri, ?options) -> Request
|
|
21
19
|
|
|
22
|
-
|
|
20
|
+
def initialize: (?options) { (self) -> void } -> void
|
|
21
|
+
| (?options) -> void
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
| (?options) -> untyped
|
|
23
|
+
private
|
|
26
24
|
|
|
27
25
|
def pool: -> Pool
|
|
28
26
|
def on_response: (Request, response) -> void
|
|
29
27
|
def on_promise: (untyped, untyped) -> void
|
|
30
|
-
def fetch_response: (Request request,
|
|
28
|
+
def fetch_response: (Request request, Array[Connection] connections, untyped options) -> response?
|
|
29
|
+
|
|
30
|
+
def find_connection: (Request request, Array[Connection] connections, Options options) -> Connection
|
|
31
31
|
|
|
32
|
-
def
|
|
32
|
+
def send_request: (Request request, Array[Connection] connections, ?Options options) -> void
|
|
33
33
|
|
|
34
|
-
def set_connection_callbacks: (Connection, Array[Connection], Options) -> void
|
|
34
|
+
def set_connection_callbacks: (Connection connection, Array[Connection] connections, Options options) -> void
|
|
35
35
|
|
|
36
|
-
def
|
|
36
|
+
def set_request_callbacks: (Request request) -> void
|
|
37
37
|
|
|
38
|
-
def
|
|
39
|
-
| (Array[[verb | string, uri, options]], options) -> Array[Request]
|
|
40
|
-
| (Array[[verb | string, uri]], options) -> Array[Request]
|
|
41
|
-
| (verb | string, _Each[[uri, options]], Options) -> Array[Request]
|
|
42
|
-
| (verb | string, _Each[uri], options) -> Array[Request]
|
|
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)?
|
|
43
39
|
|
|
44
|
-
def
|
|
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]
|
|
45
|
+
|
|
46
|
+
def init_connection: (URI::HTTP | URI::HTTP uri, Options options) -> Connection
|
|
45
47
|
|
|
46
48
|
def send_requests: (*Request) -> Array[response]
|
|
47
49
|
|
|
48
|
-
def _send_requests: (Array[Request]) -> Array[Connection]
|
|
50
|
+
def _send_requests: (Array[Request] requests) -> Array[Connection]
|
|
51
|
+
|
|
52
|
+
def receive_requests: (Array[Request] requests, Array[Connection] connections) -> Array[response]
|
|
49
53
|
|
|
50
|
-
|
|
54
|
+
attr_reader self.default_options: Options
|
|
51
55
|
end
|
|
56
|
+
|
|
57
|
+
OriginalSession: singleton(Session)
|
|
52
58
|
end
|
data/sig/timers.rbs
CHANGED
|
@@ -3,30 +3,40 @@ module HTTPX
|
|
|
3
3
|
@intervals: Array[Interval]
|
|
4
4
|
@next_interval_at: Float
|
|
5
5
|
|
|
6
|
-
def after: (Numeric interval_in_secs
|
|
6
|
+
def after: (Numeric interval_in_secs, ^() -> void) -> Interval
|
|
7
|
+
| (Numeric interval_in_secs) { () -> void } -> Interval
|
|
7
8
|
|
|
8
9
|
def wait_interval: () -> Numeric?
|
|
9
10
|
|
|
10
11
|
def fire: (?TimeoutError error) -> void
|
|
11
12
|
|
|
12
|
-
def cancel: () -> void
|
|
13
|
-
|
|
14
|
-
private
|
|
15
|
-
|
|
16
13
|
def initialize: () -> void
|
|
17
14
|
|
|
18
15
|
class Interval
|
|
19
16
|
include Comparable
|
|
20
17
|
|
|
18
|
+
type callback = ^() -> void
|
|
19
|
+
|
|
21
20
|
attr_reader interval: Numeric
|
|
22
21
|
|
|
23
|
-
@callbacks: Array[
|
|
22
|
+
@callbacks: Array[callback]
|
|
23
|
+
@on_empty: callback?
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def on_empty: () { () -> void } -> void
|
|
24
27
|
|
|
25
28
|
def to_f: () -> Float
|
|
26
29
|
|
|
27
|
-
def <<: (
|
|
30
|
+
def <<: (callback) -> void
|
|
31
|
+
|
|
32
|
+
def delete: (callback) -> void
|
|
28
33
|
|
|
29
34
|
def elapse: (Numeric elapsed) -> Numeric
|
|
35
|
+
|
|
36
|
+
def elapsed?: () -> bool
|
|
37
|
+
|
|
38
|
+
def no_callbacks?: () -> bool
|
|
39
|
+
|
|
30
40
|
private
|
|
31
41
|
|
|
32
42
|
def initialize: (Numeric interval) -> void
|
data/sig/transcoder/body.rbs
CHANGED
|
@@ -7,13 +7,14 @@ module HTTPX
|
|
|
7
7
|
class Encoder
|
|
8
8
|
extend Forwardable
|
|
9
9
|
|
|
10
|
-
include _Encoder
|
|
11
|
-
include _ToS
|
|
12
|
-
|
|
13
10
|
@raw: bodyIO
|
|
14
11
|
|
|
12
|
+
def bytesize: () -> (Integer | Float)
|
|
13
|
+
|
|
15
14
|
def content_type: () -> String
|
|
16
15
|
|
|
16
|
+
def to_s: () -> String
|
|
17
|
+
|
|
17
18
|
private
|
|
18
19
|
|
|
19
20
|
def initialize: (untyped body) -> untyped
|
data/sig/transcoder/form.rbs
CHANGED
|
@@ -3,17 +3,19 @@ module HTTPX::Transcoder
|
|
|
3
3
|
|
|
4
4
|
type form_nested_value = form_value | _ToAry[form_value] | _ToHash[string, form_value]
|
|
5
5
|
|
|
6
|
-
type urlencoded_input = Enumerable[[_ToS, form_nested_value]]
|
|
6
|
+
type urlencoded_input = Enumerable[[_ToS, form_nested_value | Multipart::multipart_nested_value]]
|
|
7
7
|
|
|
8
8
|
module Form
|
|
9
|
-
def self?.encode: (urlencoded_input form) -> Encoder
|
|
9
|
+
def self?.encode: (urlencoded_input form) -> (Encoder | Multipart::Encoder)
|
|
10
10
|
def self?.decode: (HTTPX::Response response) -> _Decoder
|
|
11
|
+
def self?.multipart?: (form_nested_value | Multipart::multipart_nested_value data) -> bool
|
|
11
12
|
|
|
12
13
|
class Encoder
|
|
13
14
|
extend Forwardable
|
|
14
|
-
include _Encoder
|
|
15
15
|
include _ToS
|
|
16
16
|
|
|
17
|
+
def bytesize: () -> Integer
|
|
18
|
+
|
|
17
19
|
def content_type: () -> String
|
|
18
20
|
|
|
19
21
|
private
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
module HTTPX
|
|
2
|
+
module Transcoder
|
|
3
|
+
module GZIP
|
|
4
|
+
def self?.encode: (_Encoder body) -> Deflater
|
|
5
|
+
def self?.decode: (Response response, ?bytesize: Integer) -> Inflater
|
|
6
|
+
|
|
7
|
+
class Deflater < Transcoder::Deflater
|
|
8
|
+
@compressed_chunk: String
|
|
9
|
+
|
|
10
|
+
private
|
|
11
|
+
|
|
12
|
+
def write: (String chunk) -> void
|
|
13
|
+
|
|
14
|
+
def compressed_chunk: () -> String
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
class Inflater
|
|
18
|
+
def initialize: (Integer | Float bytesize) -> void
|
|
19
|
+
|
|
20
|
+
def call: (String chunk) -> String
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
data/sig/transcoder/json.rbs
CHANGED
|
@@ -10,14 +10,16 @@ module HTTPX::Transcoder
|
|
|
10
10
|
|
|
11
11
|
class Encoder
|
|
12
12
|
extend Forwardable
|
|
13
|
-
include _Encoder
|
|
14
|
-
include _ToS
|
|
15
13
|
|
|
16
14
|
@raw: String
|
|
17
15
|
@charset: String
|
|
18
16
|
|
|
17
|
+
def bytesize: () -> Integer
|
|
18
|
+
|
|
19
19
|
def content_type: () -> String
|
|
20
20
|
|
|
21
|
+
def to_s: () -> String
|
|
22
|
+
|
|
21
23
|
private
|
|
22
24
|
|
|
23
25
|
def initialize: (_ToJson json) -> void
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
module HTTPX
|
|
2
|
-
module
|
|
2
|
+
module Transcoder
|
|
3
3
|
module Multipart
|
|
4
4
|
interface _MultipartInput
|
|
5
5
|
def filename: () -> String
|
|
@@ -9,13 +9,6 @@ module HTTPX
|
|
|
9
9
|
|
|
10
10
|
MULTIPART_VALUE_COND: ^(_Reader | record_multipart_value value) -> bool
|
|
11
11
|
|
|
12
|
-
def self.load_dependencies: (singleton(Session)) -> void
|
|
13
|
-
def self.configure: (*untyped) -> void
|
|
14
|
-
def self?.encode: (untyped) -> (Encoder | Transcoder::Form::Encoder)
|
|
15
|
-
def self?.decode: (HTTPX::Response response) -> Transcoder::_Decoder
|
|
16
|
-
|
|
17
|
-
def self?.normalize_keys: [U] (_ToS key, _ToAry[untyped] | _ToHash[_ToS, untyped] | untyped value) { (String, ?untyped) -> U } -> U
|
|
18
|
-
|
|
19
12
|
type multipart_value = string | Pathname | File | _Reader
|
|
20
13
|
|
|
21
14
|
type record_multipart_value = { content_type: String, filename: String, body: multipart_value } |
|
|
@@ -24,8 +17,6 @@ module HTTPX
|
|
|
24
17
|
type multipart_nested_value = multipart_value | _ToAry[multipart_value] | _ToHash[string, multipart_value]
|
|
25
18
|
|
|
26
19
|
class Encoder
|
|
27
|
-
include Transcoder::_Encoder
|
|
28
|
-
|
|
29
20
|
@boundary: String
|
|
30
21
|
@part_index: Integer
|
|
31
22
|
@buffer: String
|
|
@@ -33,6 +24,8 @@ module HTTPX
|
|
|
33
24
|
@form: Enumerable[[Symbol | string, multipart_nested_value]]
|
|
34
25
|
@parts: Array[_Reader]
|
|
35
26
|
|
|
27
|
+
def bytesize: () -> Integer
|
|
28
|
+
|
|
36
29
|
def content_type: () -> String
|
|
37
30
|
|
|
38
31
|
def read: (?int? length, ?string? buffer) -> String?
|
|
@@ -68,8 +61,6 @@ module HTTPX
|
|
|
68
61
|
def initialize: (Response response) -> void
|
|
69
62
|
|
|
70
63
|
def parse: () -> void
|
|
71
|
-
|
|
72
|
-
def get_filename: (String head) -> String?
|
|
73
64
|
end
|
|
74
65
|
|
|
75
66
|
class FilePart # < SimpleDelegator
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module HTTPX
|
|
2
|
+
module Transcoder
|
|
3
|
+
class BodyReader
|
|
4
|
+
@body: _Reader | _Each[String]
|
|
5
|
+
|
|
6
|
+
def initialize: (bodyIO body) -> void
|
|
7
|
+
|
|
8
|
+
def bytesize: () -> (Integer | Float)
|
|
9
|
+
|
|
10
|
+
def read: (?int? length, ?string outbuf) -> String?
|
|
11
|
+
|
|
12
|
+
def close: () -> void
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
module HTTPX
|
|
2
|
+
module Transcoder
|
|
3
|
+
class Deflater
|
|
4
|
+
extend Forwardable
|
|
5
|
+
|
|
6
|
+
@body: BodyReader
|
|
7
|
+
@buffer: Response::Buffer?
|
|
8
|
+
@body: _Encoder | StringIO
|
|
9
|
+
@closed: bool
|
|
10
|
+
|
|
11
|
+
attr_reader content_type: String
|
|
12
|
+
|
|
13
|
+
def initialize: (_Encoder body) -> void
|
|
14
|
+
|
|
15
|
+
def bytesize: () -> (Integer | Float)
|
|
16
|
+
|
|
17
|
+
def read: (?int? length, ?string outbuf) -> String?
|
|
18
|
+
|
|
19
|
+
def close: () -> void
|
|
20
|
+
|
|
21
|
+
def deflate: (String? chunk) -> String?
|
|
22
|
+
|
|
23
|
+
private
|
|
24
|
+
|
|
25
|
+
def buffer_deflate!: () -> void
|
|
26
|
+
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
data/sig/transcoder/xml.rbs
CHANGED
data/sig/transcoder.rbs
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
module HTTPX
|
|
2
|
-
type bodyIO = _Reader | _Each[
|
|
2
|
+
type bodyIO = _Reader | _Each[String] | _ToS
|
|
3
3
|
|
|
4
|
-
type body_encoder = Transcoder::_Encoder | _Each[String]
|
|
4
|
+
type body_encoder = (Transcoder::_Encoder & _ToS) | (Transcoder::_Encoder & _Reader) | (Transcoder::_Encoder & _Each[String])
|
|
5
5
|
|
|
6
6
|
module Transcoder
|
|
7
|
-
def self?.registry: (String tag) -> _Encode
|
|
8
|
-
| () -> Hash[String, _Encode]
|
|
9
|
-
|
|
10
|
-
def self?.register: (String tag, _Encode handler) -> void
|
|
11
|
-
|
|
12
7
|
def self?.normalize_keys: [U] (_ToS key, _ToAry[untyped] | _ToHash[_ToS, untyped] | untyped value, ?(^(untyped value) -> bool | nil) cond) { (String, ?untyped) -> U } -> U
|
|
13
8
|
|
|
14
9
|
def self?.normalize_query: (Hash[String, untyped] params, String name, String v, Integer depth) -> void
|
|
@@ -17,12 +12,32 @@ module HTTPX
|
|
|
17
12
|
def encode: (untyped payload) -> body_encoder
|
|
18
13
|
end
|
|
19
14
|
|
|
15
|
+
interface _Decode
|
|
16
|
+
def decode: (HTTPX::Response response) -> _Decoder
|
|
17
|
+
end
|
|
18
|
+
|
|
20
19
|
interface _Encoder
|
|
21
20
|
def bytesize: () -> (Integer | Float)
|
|
21
|
+
|
|
22
|
+
def content_type: () -> String
|
|
22
23
|
end
|
|
23
24
|
|
|
24
25
|
interface _Decoder
|
|
25
26
|
def call: (Response response, *untyped) -> untyped
|
|
26
27
|
end
|
|
28
|
+
|
|
29
|
+
interface _Inflater
|
|
30
|
+
def initialize: (Integer | Float bytesize) -> void
|
|
31
|
+
|
|
32
|
+
def call: (String chunk) -> String
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
interface _Deflater
|
|
36
|
+
def initialize: (Response body) -> void
|
|
37
|
+
|
|
38
|
+
def deflate: () -> void
|
|
39
|
+
|
|
40
|
+
def call: (StringIO | File buffer, ?chunk_size: Integer) ?{ (String chunk) -> void } -> void
|
|
41
|
+
end
|
|
27
42
|
end
|
|
28
43
|
end
|