httpx 0.20.0 → 1.3.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 +5 -5
- 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_19_8.md +1 -1
- data/doc/release_notes/0_20_0.md +2 -2
- data/doc/release_notes/0_20_1.md +5 -0
- data/doc/release_notes/0_20_2.md +7 -0
- data/doc/release_notes/0_20_3.md +6 -0
- data/doc/release_notes/0_20_4.md +17 -0
- data/doc/release_notes/0_20_5.md +3 -0
- data/doc/release_notes/0_21_0.md +96 -0
- 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/doc/release_notes/1_2_2.md +10 -0
- data/doc/release_notes/1_2_3.md +16 -0
- data/doc/release_notes/1_2_4.md +8 -0
- data/doc/release_notes/1_2_5.md +7 -0
- data/doc/release_notes/1_2_6.md +13 -0
- data/doc/release_notes/1_3_0.md +18 -0
- data/doc/release_notes/1_3_1.md +17 -0
- data/lib/httpx/adapters/datadog.rb +215 -122
- data/lib/httpx/adapters/faraday.rb +145 -107
- data/lib/httpx/adapters/sentry.rb +26 -7
- data/lib/httpx/adapters/webmock.rb +34 -18
- data/lib/httpx/altsvc.rb +63 -26
- 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 +75 -44
- data/lib/httpx/connection/http2.rb +31 -38
- data/lib/httpx/connection.rb +287 -117
- data/lib/httpx/domain_name.rb +10 -13
- data/lib/httpx/errors.rb +52 -2
- data/lib/httpx/extensions.rb +24 -131
- data/lib/httpx/io/ssl.rb +83 -77
- data/lib/httpx/io/tcp.rb +48 -71
- data/lib/httpx/io/udp.rb +18 -52
- data/lib/httpx/io/unix.rb +10 -15
- data/lib/httpx/io.rb +3 -9
- data/lib/httpx/loggable.rb +4 -19
- data/lib/httpx/options.rb +176 -118
- data/lib/httpx/parser/http1.rb +4 -0
- data/lib/httpx/plugins/{authentication → auth}/basic.rb +1 -5
- data/lib/httpx/plugins/{authentication → auth}/digest.rb +14 -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 +4 -3
- data/lib/httpx/plugins/aws_sigv4.rb +12 -9
- 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 +100 -0
- data/lib/httpx/plugins/circuit_breaker/circuit_store.rb +53 -0
- data/lib/httpx/plugins/circuit_breaker.rb +148 -0
- data/lib/httpx/plugins/cookies/set_cookie_parser.rb +0 -2
- data/lib/httpx/plugins/cookies.rb +30 -17
- data/lib/httpx/plugins/{digest_authentication.rb → digest_auth.rb} +14 -12
- data/lib/httpx/plugins/expect.rb +21 -14
- data/lib/httpx/plugins/follow_redirects.rb +140 -41
- 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 +36 -29
- data/lib/httpx/plugins/h2c.rb +26 -19
- 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 +175 -0
- data/lib/httpx/plugins/persistent.rb +1 -1
- data/lib/httpx/plugins/proxy/http.rb +23 -13
- data/lib/httpx/plugins/proxy/socks4.rb +9 -7
- data/lib/httpx/plugins/proxy/socks5.rb +11 -9
- data/lib/httpx/plugins/proxy.rb +80 -61
- data/lib/httpx/plugins/push_promise.rb +1 -1
- data/lib/httpx/plugins/rate_limiter.rb +5 -1
- data/lib/httpx/plugins/response_cache/file_store.rb +40 -0
- data/lib/httpx/plugins/response_cache/store.rb +62 -25
- data/lib/httpx/plugins/response_cache.rb +105 -12
- data/lib/httpx/plugins/retries.rb +87 -17
- data/lib/httpx/plugins/ssrf_filter.rb +145 -0
- data/lib/httpx/plugins/stream.rb +27 -23
- data/lib/httpx/plugins/upgrade/h2.rb +4 -4
- data/lib/httpx/plugins/upgrade.rb +8 -10
- data/lib/httpx/plugins/webdav.rb +80 -0
- data/lib/httpx/pool/synch_pool.rb +93 -0
- data/lib/httpx/pool.rb +102 -27
- data/lib/httpx/punycode.rb +9 -291
- data/lib/httpx/request/body.rb +154 -0
- data/lib/httpx/request.rb +130 -146
- data/lib/httpx/resolver/https.rb +62 -27
- data/lib/httpx/resolver/multi.rb +9 -13
- data/lib/httpx/resolver/native.rb +192 -76
- data/lib/httpx/resolver/resolver.rb +34 -9
- data/lib/httpx/resolver/system.rb +16 -11
- 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 +159 -217
- data/lib/httpx/selector.rb +9 -4
- data/lib/httpx/session.rb +137 -89
- data/lib/httpx/session_extensions.rb +4 -1
- data/lib/httpx/timers.rb +34 -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 +21 -8
- data/lib/httpx/transcoder/multipart/decoder.rb +139 -0
- data/lib/httpx/{plugins → transcoder}/multipart/encoder.rb +4 -4
- 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 +52 -0
- data/lib/httpx/transcoder.rb +5 -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 +2 -1
- data/sig/callbacks.rbs +3 -3
- data/sig/chainable.rbs +11 -9
- data/sig/connection/http1.rbs +8 -7
- data/sig/connection/http2.rbs +19 -19
- data/sig/connection.rbs +64 -24
- data/sig/errors.rbs +22 -3
- data/sig/httpx.rbs +5 -4
- data/sig/io/ssl.rbs +27 -0
- data/sig/io/tcp.rbs +60 -0
- data/sig/io/udp.rbs +20 -0
- data/sig/io/unix.rbs +27 -0
- data/sig/io.rbs +6 -0
- data/sig/options.rbs +32 -22
- data/sig/parser/http1.rbs +1 -1
- 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 +71 -0
- data/sig/plugins/compression.rbs +7 -5
- 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 +18 -4
- 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 +7 -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/http.rbs +3 -0
- data/sig/plugins/proxy/socks4.rbs +9 -6
- data/sig/plugins/proxy/socks5.rbs +10 -6
- data/sig/plugins/proxy/ssh.rbs +1 -1
- data/sig/plugins/proxy.rbs +13 -5
- data/sig/plugins/push_promise.rbs +3 -3
- data/sig/plugins/rate_limiter.rbs +1 -1
- data/sig/plugins/response_cache.rbs +36 -7
- data/sig/plugins/retries.rbs +30 -8
- data/sig/plugins/stream.rbs +24 -17
- data/sig/plugins/upgrade.rbs +5 -3
- data/sig/pool.rbs +10 -7
- data/sig/request/body.rbs +38 -0
- data/sig/request.rbs +15 -24
- data/sig/resolver/https.rbs +8 -3
- data/sig/resolver/native.rbs +17 -4
- data/sig/resolver/resolver.rbs +8 -6
- 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 +24 -39
- data/sig/selector.rbs +1 -1
- data/sig/session.rbs +29 -18
- data/sig/timers.rbs +18 -8
- 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 +8 -3
- data/sig/{plugins → transcoder}/multipart.rbs +15 -19
- 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 +22 -0
- data/sig/transcoder.rbs +24 -9
- data/sig/utils.rbs +8 -2
- metadata +163 -41
- 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 -12
- /data/sig/plugins/{authentication → auth}/ntlm.rbs +0 -0
- /data/sig/plugins/{authentication → auth}/socks5.rbs +0 -0
@@ -1,20 +1,23 @@
|
|
1
1
|
module HTTPX
|
2
|
-
Socks4Error
|
2
|
+
class Socks4Error < HTTPProxyError
|
3
|
+
end
|
3
4
|
|
4
5
|
module Plugins
|
5
6
|
module Proxy
|
6
7
|
module Socks4
|
7
|
-
|
8
|
+
|
8
9
|
module ConnectionMethods
|
9
10
|
def __socks4_proxy_connect: () -> void
|
10
11
|
def __socks4_on_packet: (String packet) -> void
|
11
12
|
def on_socks4_error: (string) -> void
|
12
13
|
end
|
13
|
-
|
14
|
+
|
14
15
|
class SocksParser
|
15
|
-
include Callbacks
|
16
|
+
include HTTPX::Callbacks
|
17
|
+
|
18
|
+
@buffer: Buffer
|
19
|
+
@options: Options
|
16
20
|
|
17
|
-
def timeout: () -> Integer
|
18
21
|
def close: () -> void
|
19
22
|
def consume: (*untyped) -> void
|
20
23
|
def empty: () -> bool
|
@@ -22,7 +25,7 @@ module HTTPX
|
|
22
25
|
|
23
26
|
private
|
24
27
|
|
25
|
-
def initialize: (Buffer buffer, Options) -> untyped
|
28
|
+
def initialize: (Buffer buffer, Options options) -> untyped
|
26
29
|
end
|
27
30
|
|
28
31
|
module Packet
|
@@ -1,21 +1,25 @@
|
|
1
1
|
module HTTPX
|
2
|
-
Socks5Error
|
2
|
+
class Socks5Error < HTTPProxyError
|
3
|
+
end
|
3
4
|
|
4
5
|
module Plugins
|
5
6
|
module Proxy
|
6
7
|
module Socks5
|
7
|
-
|
8
|
+
VERSION: Integer
|
9
|
+
|
8
10
|
module ConnectionMethods
|
9
11
|
def __socks5_proxy_connect: () -> void
|
10
12
|
def __socks5_on_packet: (String packet) -> void
|
11
13
|
def __socks5_check_version: (int) -> void
|
12
14
|
def __on_socks5_error: (string) -> void
|
13
15
|
end
|
14
|
-
|
16
|
+
|
15
17
|
class SocksParser
|
16
|
-
include Callbacks
|
18
|
+
include HTTPX::Callbacks
|
19
|
+
|
20
|
+
@buffer: Buffer
|
21
|
+
@options: Options
|
17
22
|
|
18
|
-
def timeout: () -> Integer
|
19
23
|
def close: () -> void
|
20
24
|
def consume: (*untyped) -> void
|
21
25
|
def empty: () -> bool
|
@@ -23,7 +27,7 @@ module HTTPX
|
|
23
27
|
|
24
28
|
private
|
25
29
|
|
26
|
-
def initialize: (Buffer buffer, Options) -> untyped
|
30
|
+
def initialize: (Buffer buffer, Options options) -> untyped
|
27
31
|
end
|
28
32
|
|
29
33
|
module Packet
|
data/sig/plugins/proxy/ssh.rbs
CHANGED
data/sig/plugins/proxy.rbs
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
module HTTPX
|
2
|
-
class HTTPProxyError <
|
2
|
+
class HTTPProxyError < ConnectionError
|
3
|
+
end
|
4
|
+
|
5
|
+
class ProxySSL < SSL
|
3
6
|
end
|
4
7
|
|
5
8
|
module Plugins
|
@@ -21,7 +24,7 @@ module HTTPX
|
|
21
24
|
|
22
25
|
private
|
23
26
|
|
24
|
-
def initialize: (uri: generic_uri, ?scheme: String, ?username: String, ?password: String, **
|
27
|
+
def initialize: (uri: generic_uri, ?scheme: String, ?username: String, ?password: String, **untyped) -> untyped
|
25
28
|
end
|
26
29
|
|
27
30
|
def self.configure: (singleton(Session)) -> void
|
@@ -35,11 +38,16 @@ module HTTPX
|
|
35
38
|
def self.extra_options: (Options) -> (Options & _ProxyOptions)
|
36
39
|
|
37
40
|
module InstanceMethods
|
41
|
+
@__proxy_uris: Array[generic_uri]
|
42
|
+
|
38
43
|
private
|
39
44
|
|
40
|
-
def
|
41
|
-
|
42
|
-
|
45
|
+
def proxy_error?: (Request request, response) -> bool
|
46
|
+
|
47
|
+
def proxy_options: (http_uri request_uri, Options & _ProxyOptions options) -> (Options & _ProxyOptions)
|
48
|
+
end
|
49
|
+
|
50
|
+
module ConnectionMethods
|
43
51
|
end
|
44
52
|
end
|
45
53
|
|
@@ -9,9 +9,9 @@ module HTTPX
|
|
9
9
|
module InstanceMethods
|
10
10
|
private
|
11
11
|
|
12
|
-
def promise_headers: () -> Hash[
|
13
|
-
def __on_promise_request: (Connection::HTTP2,
|
14
|
-
def __on_promise_response: (Connection::HTTP2,
|
12
|
+
def promise_headers: () -> Hash[::HTTP2::Stream, Request]
|
13
|
+
def __on_promise_request: (Connection::HTTP2, ::HTTP2::Stream, headers_input) -> void
|
14
|
+
def __on_promise_response: (Connection::HTTP2, ::HTTP2::Stream, headers_input) -> void
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
@@ -1,22 +1,33 @@
|
|
1
1
|
module HTTPX
|
2
2
|
module Plugins
|
3
3
|
module ResponseCache
|
4
|
-
CACHEABLE_VERBS: Array[
|
4
|
+
CACHEABLE_VERBS: Array[verb]
|
5
|
+
CACHEABLE_STATUS_CODES: Array[Integer]
|
5
6
|
|
6
|
-
def self?.cacheable_request?: (Request request) -> bool
|
7
|
-
def self?.cacheable_response?: (
|
7
|
+
def self?.cacheable_request?: (Request & RequestMethods request) -> bool
|
8
|
+
def self?.cacheable_response?: (::HTTPX::ErrorResponse | (Response & ResponseMethods) response) -> bool
|
8
9
|
def self?.cached_response?: (response response) -> bool
|
9
10
|
|
10
11
|
class Store
|
11
|
-
@store: Hash[
|
12
|
+
@store: Hash[String, Array[Response]]
|
12
13
|
|
13
|
-
|
14
|
+
@store_mutex: Thread::Mutex
|
14
15
|
|
15
|
-
def
|
16
|
+
def lookup: (Request request) -> Response?
|
16
17
|
|
17
|
-
def
|
18
|
+
def cached?: (Request request) -> boolish
|
19
|
+
|
20
|
+
def cache: (Request request, Response response) -> void
|
18
21
|
|
19
22
|
def prepare: (Request request) -> void
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def match_by_vary?: (Request request, Response response) -> bool
|
27
|
+
|
28
|
+
def _get: (Request request) -> Array[Response]?
|
29
|
+
|
30
|
+
def _set: (Request request, Response response) -> void
|
20
31
|
end
|
21
32
|
|
22
33
|
module InstanceMethods
|
@@ -25,8 +36,26 @@ module HTTPX
|
|
25
36
|
def clear_response_cache: () -> void
|
26
37
|
end
|
27
38
|
|
39
|
+
module RequestMethods
|
40
|
+
@response_cache_key: String
|
41
|
+
|
42
|
+
def response_cache_key: () -> String
|
43
|
+
end
|
44
|
+
|
28
45
|
module ResponseMethods
|
29
46
|
def copy_from_cached: (Response other) -> void
|
47
|
+
|
48
|
+
def fresh?: () -> bool
|
49
|
+
|
50
|
+
def cache_control: () -> Array[String]?
|
51
|
+
|
52
|
+
def vary: () -> Array[String]?
|
53
|
+
|
54
|
+
private
|
55
|
+
|
56
|
+
def age: () -> Integer
|
57
|
+
|
58
|
+
def date: () -> Time
|
30
59
|
end
|
31
60
|
end
|
32
61
|
|
data/sig/plugins/retries.rbs
CHANGED
@@ -2,40 +2,62 @@ module HTTPX
|
|
2
2
|
module Plugins
|
3
3
|
module Retries
|
4
4
|
MAX_RETRIES: Integer
|
5
|
-
IDEMPOTENT_METHODS: Array[
|
5
|
+
IDEMPOTENT_METHODS: Array[String]
|
6
6
|
RETRYABLE_ERRORS: Array[singleton(StandardError)]
|
7
7
|
DEFAULT_JITTER: ^(Numeric) -> Numeric
|
8
8
|
|
9
9
|
interface _RetryCallback
|
10
|
-
def call: (response) -> bool?
|
10
|
+
def call: (response response) -> bool?
|
11
11
|
end
|
12
12
|
|
13
13
|
interface _RetriesOptions
|
14
14
|
def retry_after: () -> Numeric?
|
15
15
|
|
16
|
-
def retry_jitter: () -> ^(Numeric) -> Numeric
|
16
|
+
def retry_jitter: () -> ^(Numeric jitter) -> Numeric
|
17
17
|
|
18
|
-
def max_retries: () -> Integer
|
18
|
+
def max_retries: () -> Integer
|
19
19
|
|
20
20
|
def retry_change_requests: () -> boolish
|
21
21
|
|
22
22
|
def retry_on: () -> _RetryCallback?
|
23
23
|
end
|
24
24
|
|
25
|
-
def self.extra_options: (Options) ->
|
25
|
+
def self.extra_options: (Options options) -> retriesOptions
|
26
26
|
|
27
27
|
module InstanceMethods
|
28
28
|
def max_retries: (int) -> instance
|
29
29
|
|
30
30
|
private
|
31
31
|
|
32
|
-
def
|
33
|
-
|
32
|
+
def fetch_response: (retriesRequest request, Array[Connection] connections, retriesOptions options) -> (retriesResponse | ErrorResponse)?
|
33
|
+
|
34
|
+
def __repeatable_request?: (retriesRequest request, retriesOptions options) -> boolish
|
35
|
+
|
36
|
+
def __retryable_error?: (_Exception error) -> bool
|
37
|
+
|
38
|
+
def __try_partial_retry: (retriesRequest request, (retriesResponse | ErrorResponse) response) -> void
|
39
|
+
|
34
40
|
end
|
35
41
|
|
36
42
|
module RequestMethods
|
37
|
-
|
43
|
+
@options: Options & _RetriesOptions
|
44
|
+
|
45
|
+
attr_accessor retries: Integer
|
46
|
+
|
47
|
+
attr_writer partial_response: Response?
|
48
|
+
|
49
|
+
def response=: (retriesResponse | ErrorResponse response) -> void
|
50
|
+
end
|
51
|
+
|
52
|
+
module ResponseMethods
|
53
|
+
def from_partial_response: (Response response) -> void
|
38
54
|
end
|
55
|
+
|
56
|
+
type retriesOptions = Options & _RetriesOptions
|
57
|
+
|
58
|
+
type retriesRequest = Request & RequestMethods
|
59
|
+
|
60
|
+
type retriesResponse = Response & ResponseMethods
|
39
61
|
end
|
40
62
|
|
41
63
|
type sessionRetries = Session & Retries::InstanceMethods
|
data/sig/plugins/stream.rbs
CHANGED
@@ -1,21 +1,4 @@
|
|
1
1
|
module HTTPX
|
2
|
-
class StreamResponse
|
3
|
-
include _ToS
|
4
|
-
|
5
|
-
def each: () { (String) -> void } -> void
|
6
|
-
| () -> Enumerable[String]
|
7
|
-
|
8
|
-
def each_line: () { (String) -> void } -> void
|
9
|
-
| () -> Enumerable[String]
|
10
|
-
|
11
|
-
def on_chunk: (string) -> void
|
12
|
-
|
13
|
-
private
|
14
|
-
|
15
|
-
def response: () -> response
|
16
|
-
def initialize: (Request, Session, Array[Connection]) -> untyped
|
17
|
-
end
|
18
|
-
|
19
2
|
module Plugins
|
20
3
|
module Stream
|
21
4
|
module InstanceMethods
|
@@ -37,4 +20,28 @@ module HTTPX
|
|
37
20
|
|
38
21
|
type sessionStream = Session & Stream::InstanceMethods
|
39
22
|
end
|
23
|
+
|
24
|
+
class StreamResponse
|
25
|
+
include _ToS
|
26
|
+
|
27
|
+
type streamRequest = Request & Plugins::Stream::RequestMethods
|
28
|
+
|
29
|
+
@request: streamRequest
|
30
|
+
@session: Plugins::sessionStream
|
31
|
+
@on_chunk: ^(String) -> void | nil
|
32
|
+
|
33
|
+
def each: () { (String) -> void } -> void
|
34
|
+
| () -> Enumerable[String]
|
35
|
+
|
36
|
+
def each_line: () { (String) -> void } -> void
|
37
|
+
| () -> Enumerable[String]
|
38
|
+
|
39
|
+
def on_chunk: (string) -> void
|
40
|
+
|
41
|
+
def initialize: (streamRequest, Plugins::sessionStream) -> void
|
42
|
+
|
43
|
+
private
|
44
|
+
|
45
|
+
def response: () -> response
|
46
|
+
end
|
40
47
|
end
|
data/sig/plugins/upgrade.rbs
CHANGED
@@ -1,18 +1,20 @@
|
|
1
1
|
module HTTPX
|
2
2
|
module Plugins
|
3
3
|
module Upgrade
|
4
|
-
|
4
|
+
interface _Upgrader
|
5
|
+
def call: (Connection connection, Request request, Response response) -> void
|
6
|
+
end
|
5
7
|
|
6
8
|
def self.configure: (singleton(Session)) -> void
|
7
9
|
|
8
10
|
interface _UpgradeOptions
|
9
|
-
def upgrade_handlers: () ->
|
11
|
+
def upgrade_handlers: () -> Hash[String, _Upgrader]
|
10
12
|
end
|
11
13
|
|
12
14
|
def self.extra_options: (Options) -> (Options & _UpgradeOptions)
|
13
15
|
|
14
16
|
module ConnectionMethods
|
15
|
-
attr_reader upgrade_protocol:
|
17
|
+
attr_reader upgrade_protocol: String?
|
16
18
|
attr_reader hijacked: boolish
|
17
19
|
|
18
20
|
def hijack_io: () -> void
|
data/sig/pool.rbs
CHANGED
@@ -6,7 +6,8 @@ module HTTPX
|
|
6
6
|
@timers: Timers
|
7
7
|
@selector: Selector
|
8
8
|
@connections: Array[Connection]
|
9
|
-
|
9
|
+
|
10
|
+
def wrap: () { (instance) -> void } -> void
|
10
11
|
|
11
12
|
def empty?: () -> void
|
12
13
|
|
@@ -18,11 +19,13 @@ module HTTPX
|
|
18
19
|
|
19
20
|
def find_connection: (URI::Generic uri, Options options) -> Connection?
|
20
21
|
|
21
|
-
def deactivate: (*
|
22
|
+
def deactivate: (*Connection connections) -> void
|
22
23
|
|
23
24
|
private
|
24
25
|
|
25
|
-
def initialize: () ->
|
26
|
+
def initialize: () -> void
|
27
|
+
|
28
|
+
def try_clone_connection: (Connection connection, Integer? family) -> Connection
|
26
29
|
|
27
30
|
def resolve_connection: (Connection) -> void
|
28
31
|
|
@@ -34,15 +37,15 @@ module HTTPX
|
|
34
37
|
|
35
38
|
def register_connection: (Connection) -> void
|
36
39
|
|
37
|
-
def unregister_connection: (Connection) -> void
|
40
|
+
def unregister_connection: (Connection, ?bool cleanup) -> void
|
38
41
|
|
39
|
-
def select_connection: (
|
42
|
+
def select_connection: (Selector::selectable) -> void
|
40
43
|
|
41
|
-
def deselect_connection: (
|
44
|
+
def deselect_connection: (Selector::selectable) -> Selector::selectable?
|
42
45
|
|
43
46
|
def coalesce_connections: (Connection coalescable, Connection coalescing) -> void
|
44
47
|
|
45
|
-
def next_timeout: () ->
|
48
|
+
def next_timeout: () -> Numeric?
|
46
49
|
|
47
50
|
def find_resolver_for: (Connection) { (Resolver::Resolver resolver) -> void } -> resolver_manager
|
48
51
|
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module HTTPX
|
2
|
+
class Request::Body
|
3
|
+
@headers: Headers
|
4
|
+
@body: body_encoder?
|
5
|
+
@unbounded_body: bool
|
6
|
+
|
7
|
+
def initialize: (Headers headers, Options options, ?body: bodyIO, ?form: Transcoder::urlencoded_input?, ?json: _ToJson?, **untyped) -> void
|
8
|
+
|
9
|
+
def each: () { (String) -> void } -> void
|
10
|
+
| () -> Enumerable[String]
|
11
|
+
|
12
|
+
def rewind: () -> void
|
13
|
+
|
14
|
+
def empty?: () -> bool
|
15
|
+
|
16
|
+
def bytesize: () -> (Integer | Float)
|
17
|
+
|
18
|
+
def stream: (Transcoder::_Encoder) -> bodyIO
|
19
|
+
|
20
|
+
def unbounded_body?: () -> bool
|
21
|
+
|
22
|
+
def chunked?: () -> bool
|
23
|
+
|
24
|
+
def chunk!: () -> void
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def self.initialize_deflater_body: (body_encoder body, Encoding | String encoding) -> body_encoder
|
29
|
+
end
|
30
|
+
|
31
|
+
class ProcIO
|
32
|
+
@block: ^(String) -> void
|
33
|
+
|
34
|
+
def initialize: (^(String) -> void) -> untyped
|
35
|
+
|
36
|
+
def write: (String data) -> Integer
|
37
|
+
end
|
38
|
+
end
|
data/sig/request.rbs
CHANGED
@@ -6,8 +6,8 @@ module HTTPX
|
|
6
6
|
METHODS: Array[Symbol]
|
7
7
|
USER_AGENT: String
|
8
8
|
|
9
|
-
attr_reader verb:
|
10
|
-
attr_reader uri:
|
9
|
+
attr_reader verb: verb
|
10
|
+
attr_reader uri: http_uri
|
11
11
|
attr_reader headers: Headers
|
12
12
|
attr_reader body: Body
|
13
13
|
attr_reader state: Symbol
|
@@ -15,12 +15,17 @@ module HTTPX
|
|
15
15
|
attr_reader response: response?
|
16
16
|
attr_reader drain_error: StandardError?
|
17
17
|
|
18
|
+
attr_accessor peer_address: ipaddr?
|
19
|
+
|
20
|
+
attr_writer persistent: bool
|
21
|
+
|
22
|
+
@query_params: Hash[interned, untyped]?
|
18
23
|
@trailers: Headers?
|
19
24
|
@informational_status: Integer?
|
20
25
|
@query: String?
|
21
26
|
@drainer: Enumerator[String, void]?
|
22
27
|
|
23
|
-
def initialize: (Symbol | String, generic_uri, ?
|
28
|
+
def initialize: (Symbol | String verb, generic_uri uri, Options options, ?request_params params) -> untyped
|
24
29
|
|
25
30
|
def interests: () -> (:r | :w)
|
26
31
|
|
@@ -50,31 +55,17 @@ module HTTPX
|
|
50
55
|
|
51
56
|
def trailers?: () -> boolish
|
52
57
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
@unbounded_body: bool
|
58
|
+
def persistent?: () -> bool
|
59
|
+
|
60
|
+
def read_timeout: () -> Numeric?
|
57
61
|
|
58
|
-
|
59
|
-
def each: () { (String) -> void } -> void
|
60
|
-
| () -> Enumerable[String]
|
62
|
+
def write_timeout: () -> Numeric?
|
61
63
|
|
62
|
-
|
63
|
-
def empty?: () -> bool
|
64
|
-
def bytesize: () -> Numeric
|
65
|
-
def stream: (Transcoder::_Encoder) -> bodyIO
|
66
|
-
def unbounded_body?: () -> bool
|
67
|
-
def chunked?: () -> bool
|
68
|
-
def chunk!: () -> void
|
69
|
-
def inspect: () -> String
|
70
|
-
end
|
64
|
+
def request_timeout: () -> Numeric?
|
71
65
|
|
72
|
-
|
73
|
-
@block: ^(String) -> void
|
66
|
+
private
|
74
67
|
|
75
|
-
|
68
|
+
def initialize_body: (Options options) -> Transcoder::_Encoder?
|
76
69
|
|
77
|
-
def write: (String data) -> Integer
|
78
|
-
end
|
79
70
|
end
|
80
71
|
end
|
data/sig/resolver/https.rbs
CHANGED
@@ -6,11 +6,12 @@ module HTTPX
|
|
6
6
|
DEFAULTS: Hash[Symbol, untyped]
|
7
7
|
FAMILY_TYPES: Hash[singleton(Resolv::DNS::Resource), String]
|
8
8
|
|
9
|
-
|
9
|
+
attr_reader family: ip_family
|
10
|
+
|
10
11
|
@options: Options
|
11
12
|
@requests: Hash[Request, String]
|
12
13
|
@connections: Array[Connection]
|
13
|
-
@uri:
|
14
|
+
@uri: http_uri
|
14
15
|
@uri_addresses: Array[String]?
|
15
16
|
@resolver: Resolv::DNS
|
16
17
|
@resolver_connection: Connection
|
@@ -31,9 +32,13 @@ module HTTPX
|
|
31
32
|
|
32
33
|
def parse: (Request request, Response response) -> void
|
33
34
|
|
35
|
+
def parse_addresses: (Array[dns_result] answers, Request request) -> void
|
36
|
+
|
34
37
|
def build_request: (String hostname) -> Request
|
35
38
|
|
36
|
-
def decode_response_body: (Response) ->
|
39
|
+
def decode_response_body: (Response) -> dns_decoding_response
|
40
|
+
|
41
|
+
def reset_hostname: (String hostname, ?reset_candidates: bool) -> Connection?
|
37
42
|
end
|
38
43
|
end
|
39
44
|
end
|
data/sig/resolver/native.rbs
CHANGED
@@ -7,15 +7,22 @@ module HTTPX
|
|
7
7
|
DEFAULTS: Hash[Symbol, untyped]
|
8
8
|
DNS_PORT: Integer
|
9
9
|
|
10
|
-
|
10
|
+
attr_reader family: ip_family
|
11
|
+
|
11
12
|
@options: Options
|
12
13
|
@ns_index: Integer
|
13
|
-
@nameserver: String
|
14
|
+
@nameserver: Array[String]
|
15
|
+
@socket_type: :udp | :tcp
|
16
|
+
@ndots: Integer
|
17
|
+
@start_timeout: Float?
|
18
|
+
@search: Array[String]
|
14
19
|
@_timeouts: Array[Numeric]
|
15
20
|
@timeouts: Hash[String, Array[Numeric]]
|
16
21
|
@connections: Array[Connection]
|
17
22
|
@read_buffer: String
|
18
23
|
@write_buffer: Buffer
|
24
|
+
@large_packet: Buffer?
|
25
|
+
@io: UDP | TCP
|
19
26
|
|
20
27
|
attr_reader state: Symbol
|
21
28
|
|
@@ -27,6 +34,8 @@ module HTTPX
|
|
27
34
|
|
28
35
|
def timeout: () -> Numeric?
|
29
36
|
|
37
|
+
def handle_socket_timeout: (Numeric interval) -> void
|
38
|
+
|
30
39
|
private
|
31
40
|
|
32
41
|
def initialize: (ip_family family, options options) -> void
|
@@ -35,7 +44,7 @@ module HTTPX
|
|
35
44
|
|
36
45
|
def consume: () -> void
|
37
46
|
|
38
|
-
def do_retry: () -> void
|
47
|
+
def do_retry: (?Numeric? loop_time) -> void
|
39
48
|
|
40
49
|
def dread: (Integer) -> void
|
41
50
|
| () -> void
|
@@ -48,11 +57,15 @@ module HTTPX
|
|
48
57
|
|
49
58
|
def generate_candidates: (String) -> Array[String]
|
50
59
|
|
51
|
-
def build_socket: () ->
|
60
|
+
def build_socket: () -> (UDP | TCP)
|
61
|
+
|
62
|
+
def downgrade_socket: () -> void
|
52
63
|
|
53
64
|
def transition: (Symbol nextstate) -> void
|
54
65
|
|
55
66
|
def handle_error: (NativeResolveError | StandardError) -> void
|
67
|
+
|
68
|
+
def reset_hostname: (String hostname, ?connection: Connection, ?reset_candidates: bool) -> void
|
56
69
|
end
|
57
70
|
end
|
58
71
|
end
|
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
|
27
|
+
def emit_resolved_connection: (Connection connection, Array[IPAddr] addresses, bool early_resolve) -> void
|
28
|
+
|
29
|
+
def initialize: (ip_family? family, Options options) -> void
|
28
30
|
|
29
|
-
def early_resolve: (Connection connection, ?hostname: String) ->
|
31
|
+
def early_resolve: (Connection connection, ?hostname: String) -> boolish
|
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
|