httpx 0.22.4 → 0.23.0
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/doc/release_notes/0_22_5.md +6 -0
- data/doc/release_notes/0_23_0.md +42 -0
- data/lib/httpx/adapters/datadog.rb +12 -2
- data/lib/httpx/adapters/faraday.rb +1 -1
- data/lib/httpx/adapters/sentry.rb +15 -5
- data/lib/httpx/adapters/webmock.rb +2 -2
- data/lib/httpx/buffer.rb +4 -0
- data/lib/httpx/callbacks.rb +3 -3
- data/lib/httpx/chainable.rb +4 -4
- data/lib/httpx/connection/http1.rb +2 -2
- data/lib/httpx/connection/http2.rb +2 -3
- data/lib/httpx/connection.rb +31 -11
- data/lib/httpx/io/udp.rb +2 -0
- data/lib/httpx/io/unix.rb +1 -5
- data/lib/httpx/io.rb +0 -10
- data/lib/httpx/options.rb +16 -2
- data/lib/httpx/plugins/authentication/digest.rb +1 -1
- data/lib/httpx/plugins/aws_sdk_authentication.rb +1 -3
- data/lib/httpx/plugins/aws_sigv4.rb +1 -1
- data/lib/httpx/plugins/compression/brotli.rb +4 -4
- data/lib/httpx/plugins/compression/deflate.rb +12 -7
- data/lib/httpx/plugins/compression/gzip.rb +7 -5
- data/lib/httpx/plugins/compression.rb +9 -8
- data/lib/httpx/plugins/digest_authentication.rb +1 -4
- data/lib/httpx/plugins/follow_redirects.rb +1 -1
- data/lib/httpx/plugins/grpc/message.rb +3 -1
- data/lib/httpx/plugins/grpc.rb +3 -3
- data/lib/httpx/plugins/h2c.rb +5 -9
- data/lib/httpx/plugins/internal_telemetry.rb +16 -0
- data/lib/httpx/plugins/multipart.rb +14 -2
- data/lib/httpx/plugins/proxy/http.rb +4 -4
- data/lib/httpx/plugins/proxy.rb +65 -31
- data/lib/httpx/plugins/response_cache.rb +2 -2
- data/lib/httpx/plugins/retries.rb +49 -2
- data/lib/httpx/plugins/upgrade/h2.rb +3 -3
- data/lib/httpx/plugins/upgrade.rb +4 -7
- data/lib/httpx/plugins/webdav.rb +7 -7
- data/lib/httpx/pool.rb +7 -3
- data/lib/httpx/request.rb +23 -13
- data/lib/httpx/resolver/https.rb +37 -20
- data/lib/httpx/resolver/multi.rb +1 -6
- data/lib/httpx/resolver/native.rb +128 -36
- data/lib/httpx/resolver.rb +26 -14
- data/lib/httpx/response.rb +14 -16
- data/lib/httpx/session.rb +1 -0
- data/lib/httpx/transcoder/body.rb +0 -1
- data/lib/httpx/transcoder/chunker.rb +0 -1
- data/lib/httpx/transcoder/form.rb +0 -1
- data/lib/httpx/transcoder/json.rb +0 -1
- data/lib/httpx/transcoder/xml.rb +0 -1
- data/lib/httpx/transcoder.rb +0 -2
- data/lib/httpx/version.rb +1 -1
- data/lib/httpx.rb +0 -1
- data/sig/buffer.rbs +1 -0
- data/sig/chainable.rbs +3 -3
- data/sig/connection.rbs +17 -6
- data/sig/errors.rbs +9 -0
- data/sig/httpx.rbs +3 -3
- data/sig/io/ssl.rbs +17 -0
- data/sig/io/tcp.rbs +57 -0
- data/sig/io/udp.rbs +20 -0
- data/sig/io/unix.rbs +10 -0
- data/sig/options.rbs +5 -1
- data/sig/plugins/compression.rbs +6 -2
- data/sig/plugins/cookies/jar.rbs +2 -2
- data/sig/plugins/grpc.rbs +3 -3
- data/sig/plugins/h2c.rbs +1 -1
- data/sig/plugins/proxy.rbs +1 -5
- data/sig/plugins/response_cache.rbs +1 -1
- data/sig/plugins/retries.rbs +28 -8
- data/sig/plugins/upgrade.rbs +5 -3
- data/sig/request.rbs +6 -2
- data/sig/resolver/https.rbs +3 -1
- data/sig/resolver/native.rbs +7 -2
- data/sig/resolver/resolver.rbs +0 -2
- data/sig/resolver/system.rbs +2 -0
- data/sig/resolver.rbs +8 -4
- data/sig/response.rbs +6 -2
- data/sig/session.rbs +10 -10
- data/sig/transcoder/xml.rbs +1 -1
- data/sig/transcoder.rbs +4 -5
- metadata +11 -5
- data/lib/httpx/registry.rb +0 -85
- data/sig/registry.rbs +0 -13
data/sig/connection.rbs
CHANGED
@@ -17,9 +17,7 @@ module HTTPX
|
|
17
17
|
extend Forwardable
|
18
18
|
include Loggable
|
19
19
|
include Callbacks
|
20
|
-
include HTTPX::Registry[String, Class]
|
21
20
|
|
22
|
-
BUFFER_SIZE: Integer
|
23
21
|
|
24
22
|
attr_reader type: io_type
|
25
23
|
attr_reader origin: URI::Generic
|
@@ -36,7 +34,13 @@ module HTTPX
|
|
36
34
|
@write_buffer: Buffer
|
37
35
|
@inflight: Integer
|
38
36
|
@keep_alive_timeout: Numeric?
|
37
|
+
@timeout: Numeric?
|
38
|
+
@current_timeout: Numeric?
|
39
39
|
@total_timeout: Numeric?
|
40
|
+
@io: TCP | SSL | UNIX
|
41
|
+
@parser: HTTP1 | HTTP2 | _Parser
|
42
|
+
@connected_at: Float
|
43
|
+
@response_received_at: Float
|
40
44
|
|
41
45
|
def addresses: () -> Array[ipaddr]?
|
42
46
|
|
@@ -77,6 +81,8 @@ module HTTPX
|
|
77
81
|
|
78
82
|
def deactivate: () -> void
|
79
83
|
|
84
|
+
def open?: () -> bool
|
85
|
+
|
80
86
|
def raise_timeout_error: (Numeric interval) -> void
|
81
87
|
|
82
88
|
private
|
@@ -91,17 +97,20 @@ module HTTPX
|
|
91
97
|
|
92
98
|
def send_pending: () -> void
|
93
99
|
|
94
|
-
def parser: () -> _Parser
|
100
|
+
def parser: () -> (HTTP1 | HTTP2 | _Parser)
|
95
101
|
|
96
102
|
def send_request_to_parser: (Request request) -> void
|
97
103
|
|
98
|
-
def build_parser: () ->
|
99
|
-
| (String) -> _Parser
|
104
|
+
def build_parser: (?String protocol) -> (HTTP1 | HTTP2)
|
100
105
|
|
101
|
-
def set_parser_callbacks: (
|
106
|
+
def set_parser_callbacks: (HTTP1 | HTTP2 parser) -> void
|
102
107
|
|
103
108
|
def transition: (Symbol) -> void
|
104
109
|
|
110
|
+
def handle_transition: (Symbol) -> void
|
111
|
+
|
112
|
+
def build_socket: (?Array[ipaddr]? addrs) -> (TCP | SSL | UNIX)
|
113
|
+
|
105
114
|
def on_error: (HTTPX::TimeoutError | Error | StandardError) -> void
|
106
115
|
|
107
116
|
def handle_error: (StandardError) -> void
|
@@ -113,5 +122,7 @@ module HTTPX
|
|
113
122
|
def write_timeout_callback: (Request request, Numeric write_timeout) -> void
|
114
123
|
|
115
124
|
def read_timeout_callback: (Request request, Numeric read_timeout, ?singleton(RequestTimeoutError) error_type) -> void
|
125
|
+
|
126
|
+
def self.parser_type: (String protocol) -> (singleton(HTTP1) | singleton(HTTP2))
|
116
127
|
end
|
117
128
|
end
|
data/sig/errors.rbs
CHANGED
@@ -2,6 +2,12 @@ module HTTPX
|
|
2
2
|
class Error < StandardError
|
3
3
|
end
|
4
4
|
|
5
|
+
class UnsupportedSchemeError < Error
|
6
|
+
end
|
7
|
+
|
8
|
+
class ConnectionError < Error
|
9
|
+
end
|
10
|
+
|
5
11
|
class TimeoutError < Error
|
6
12
|
attr_reader timeout: Numeric
|
7
13
|
|
@@ -55,4 +61,7 @@ module HTTPX
|
|
55
61
|
|
56
62
|
def initialize: (Connection connection, String hostname, ?String message) -> untyped
|
57
63
|
end
|
64
|
+
|
65
|
+
class MisdirectedRequestError < HTTPError
|
66
|
+
end
|
58
67
|
end
|
data/sig/httpx.rbs
CHANGED
@@ -8,9 +8,9 @@ module HTTPX
|
|
8
8
|
type uri = URI::HTTP | URI::HTTPS | string
|
9
9
|
type generic_uri = String | URI::Generic
|
10
10
|
|
11
|
-
type verb =
|
12
|
-
|
13
|
-
|
11
|
+
type verb = "OPTIONS" | "GET" | "HEAD" | "POST" | "PUT" | "DELETE" | "TRACE" | "CONNECT" |
|
12
|
+
"PROPFIND" | "PROPPATCH" | "MKCOL" | "COPY" | "MOVE" | "LOCK" | "UNLOCK" | "ORDERPATCH" |
|
13
|
+
"ACL" | "REPORT" | "PATCH" | "SEARCH"
|
14
14
|
|
15
15
|
type ip_family = Integer #Socket::AF_INET6 | Socket::AF_INET
|
16
16
|
|
data/sig/io/ssl.rbs
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
module HTTPX
|
2
|
+
IPRegex: Regexp
|
3
|
+
|
4
|
+
class TLSError < OpenSSL::SSL::SSLError
|
5
|
+
end
|
6
|
+
|
7
|
+
class SSL < TCP
|
8
|
+
TLS_OPTIONS: Hash[Symbol, untyped]
|
9
|
+
|
10
|
+
def can_verify_peer?: () -> bool
|
11
|
+
|
12
|
+
def verify_hostname: (String host) -> bool
|
13
|
+
|
14
|
+
# :nocov:
|
15
|
+
def try_ssl_connect: () -> void
|
16
|
+
end
|
17
|
+
end
|
data/sig/io/tcp.rbs
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
module HTTPX
|
2
|
+
class TCP
|
3
|
+
include Loggable
|
4
|
+
|
5
|
+
attr_reader ip: IPAddr?
|
6
|
+
|
7
|
+
attr_reader port: Integer
|
8
|
+
|
9
|
+
attr_reader addresses: Array[ipaddr]
|
10
|
+
|
11
|
+
attr_reader state: Symbol
|
12
|
+
|
13
|
+
attr_reader interests: io_interests
|
14
|
+
|
15
|
+
alias host ip
|
16
|
+
|
17
|
+
def initialize: (URI::Generic origin, Array[ipaddr]? addresses, options options) -> void
|
18
|
+
|
19
|
+
def add_addresses: (Array[ipaddr] addrs) -> void
|
20
|
+
|
21
|
+
def to_io: () -> ::IO
|
22
|
+
|
23
|
+
def protocol: () -> String
|
24
|
+
|
25
|
+
def connect: () -> void
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
# :nocov:
|
30
|
+
def try_connect: () -> void
|
31
|
+
|
32
|
+
public
|
33
|
+
|
34
|
+
def read: (Integer size, ?(Buffer | String) buffer) -> (0 | nil | untyped)
|
35
|
+
|
36
|
+
def write: (Buffer buffer) -> Integer?
|
37
|
+
|
38
|
+
def close: () -> void
|
39
|
+
|
40
|
+
def connected?: () -> bool
|
41
|
+
|
42
|
+
def closed?: () -> bool
|
43
|
+
|
44
|
+
# :nocov:
|
45
|
+
def inspect: () -> ::String
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def build_socket: () -> Socket
|
50
|
+
|
51
|
+
def transition: (Symbol nextstate) -> void
|
52
|
+
|
53
|
+
def do_transition: (Symbol nextstate) -> void
|
54
|
+
|
55
|
+
def log_transition_state: (Symbol nextstate) -> void
|
56
|
+
end
|
57
|
+
end
|
data/sig/io/udp.rbs
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
module HTTPX
|
2
|
+
class UDP
|
3
|
+
include Loggable
|
4
|
+
|
5
|
+
def initialize: (String ip, Integer port, Options options) -> void
|
6
|
+
|
7
|
+
def to_io: () -> ::IO
|
8
|
+
|
9
|
+
def connect: () -> void
|
10
|
+
|
11
|
+
def connected?: () -> bool
|
12
|
+
|
13
|
+
# :nocov:
|
14
|
+
def close: () -> void
|
15
|
+
|
16
|
+
def read: (Integer size, ?(Buffer | String) buffer) -> Integer?
|
17
|
+
|
18
|
+
def write: (Buffer buffer) -> Integer?
|
19
|
+
end
|
20
|
+
end
|
data/sig/io/unix.rbs
ADDED
data/sig/options.rbs
CHANGED
@@ -2,6 +2,7 @@ module HTTPX
|
|
2
2
|
class Options
|
3
3
|
# include _ToHash
|
4
4
|
|
5
|
+
BUFFER_SIZE: Integer
|
5
6
|
WINDOW_SIZE: Integer
|
6
7
|
MAX_BODY_THRESHOLD_SIZE: Integer
|
7
8
|
CONNECT_TIMEOUT: Integer
|
@@ -38,11 +39,14 @@ module HTTPX
|
|
38
39
|
# window_size
|
39
40
|
attr_reader window_size: Integer
|
40
41
|
|
42
|
+
# buffer_size
|
43
|
+
attr_reader buffer_size: Integer
|
44
|
+
|
41
45
|
# body_threshold_size
|
42
46
|
attr_reader body_threshold_size: Integer
|
43
47
|
|
44
48
|
# transport
|
45
|
-
attr_reader transport:
|
49
|
+
attr_reader transport: "unix" | nil
|
46
50
|
|
47
51
|
# transport_options
|
48
52
|
attr_reader transport_options: Hash[untyped, untyped]?
|
data/sig/plugins/compression.rbs
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
module HTTPX
|
2
2
|
module Plugins
|
3
3
|
module Compression
|
4
|
-
type encodings_registry = Registry[Symbol, Class]
|
5
4
|
|
6
5
|
type deflatable = _Reader | _ToS
|
7
6
|
|
@@ -16,12 +15,17 @@ module HTTPX
|
|
16
15
|
def initialize: (Integer | Float bytesize) -> untyped
|
17
16
|
end
|
18
17
|
|
18
|
+
interface _Compressor
|
19
|
+
def deflater: () -> _Deflater
|
20
|
+
def inflater: (Integer | Float bytesize) -> _Inflater
|
21
|
+
end
|
22
|
+
|
19
23
|
def self.configure: (singleton(Session)) -> void
|
20
24
|
|
21
25
|
interface _CompressionOptions
|
22
26
|
def compression_threshold_size: () -> Integer?
|
23
27
|
|
24
|
-
def encodings: () ->
|
28
|
+
def encodings: () -> Hash[String, _Compressor]
|
25
29
|
end
|
26
30
|
|
27
31
|
def self.extra_options: (Options) -> (Options & _CompressionOptions)
|
data/sig/plugins/cookies/jar.rbs
CHANGED
@@ -13,8 +13,8 @@ module HTTPX
|
|
13
13
|
|
14
14
|
def []: (uri) -> Array[Cookie]
|
15
15
|
|
16
|
-
def each: (?uri) { (Cookie) -> void } -> void
|
17
|
-
| (?uri) -> Enumerable[Cookie]
|
16
|
+
def each: (?uri?) { (Cookie) -> void } -> void
|
17
|
+
| (?uri?) -> Enumerable[Cookie]
|
18
18
|
|
19
19
|
def merge: (_Each[cookie] cookies) -> instance
|
20
20
|
|
data/sig/plugins/grpc.rbs
CHANGED
@@ -39,8 +39,8 @@ module HTTPX
|
|
39
39
|
|
40
40
|
def self?.encode: (String bytes, ?deflater: Compression::_Deflater?) -> String
|
41
41
|
|
42
|
-
def self?.decode: (String message, encodings: Array[String], encoders: Compression::
|
43
|
-
| (String message, encodings: Array[String], encoders: Compression::
|
42
|
+
def self?.decode: (String message, encodings: Array[String], encoders: Hash[String, Compression::_Compressor]) -> String
|
43
|
+
| (String message, encodings: Array[String], encoders: Hash[String, Compression::_Compressor]) { (String) -> void } -> void
|
44
44
|
|
45
45
|
def self?.cancel: (Request) -> void
|
46
46
|
|
@@ -65,7 +65,7 @@ module HTTPX
|
|
65
65
|
module ResponseMethods
|
66
66
|
def merge_headers: (headers_input trailers) -> void
|
67
67
|
|
68
|
-
def encoders: () -> Compression::
|
68
|
+
def encoders: () -> Hash[String, Compression::_Compressor]
|
69
69
|
end
|
70
70
|
|
71
71
|
module InstanceMethods
|
data/sig/plugins/h2c.rbs
CHANGED
data/sig/plugins/proxy.rbs
CHANGED
@@ -35,11 +35,7 @@ module HTTPX
|
|
35
35
|
def self.extra_options: (Options) -> (Options & _ProxyOptions)
|
36
36
|
|
37
37
|
module InstanceMethods
|
38
|
-
|
39
|
-
|
40
|
-
def proxy_uris: (generic_uri, Options & _ProxyOptions) -> { uri: generic_uri, username: String, password: String }
|
41
|
-
| (generic_uri, Options & _ProxyOptions) -> { uri: generic_uri }
|
42
|
-
| (generic_uri, Options & _ProxyOptions) -> nil
|
38
|
+
@__proxy_uris: Array[generic_uri]
|
43
39
|
end
|
44
40
|
end
|
45
41
|
|
data/sig/plugins/retries.rbs
CHANGED
@@ -2,40 +2,60 @@ 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 __repeatable_request?: (
|
33
|
-
|
32
|
+
def __repeatable_request?: (retriesRequest request, retriesOptions options) -> boolish
|
33
|
+
|
34
|
+
def __retryable_error?: (_Exception error) -> bool
|
35
|
+
|
36
|
+
def __try_partial_retry: (retriesRequest request, (retriesResponse | ErrorResponse) response) -> void
|
37
|
+
|
34
38
|
end
|
35
39
|
|
36
40
|
module RequestMethods
|
37
|
-
|
41
|
+
@options: Options & _RetriesOptions
|
42
|
+
|
43
|
+
attr_accessor retries: Integer
|
44
|
+
|
45
|
+
attr_writer partial_response: Response?
|
46
|
+
|
47
|
+
def response=: (retriesResponse | ErrorResponse response) -> void
|
38
48
|
end
|
49
|
+
|
50
|
+
module ResponseMethods
|
51
|
+
def from_partial_response: (Response response) -> void
|
52
|
+
end
|
53
|
+
|
54
|
+
type retriesOptions = Options & _RetriesOptions
|
55
|
+
|
56
|
+
type retriesRequest = Request & RequestMethods
|
57
|
+
|
58
|
+
type retriesResponse = Response & ResponseMethods
|
39
59
|
end
|
40
60
|
|
41
61
|
type sessionRetries = Session & Retries::InstanceMethods
|
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/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: URI::
|
9
|
+
attr_reader verb: verb
|
10
|
+
attr_reader uri: URI::HTTP | URI::HTTPS
|
11
11
|
attr_reader headers: Headers
|
12
12
|
attr_reader body: Body
|
13
13
|
attr_reader state: Symbol
|
@@ -56,6 +56,10 @@ module HTTPX
|
|
56
56
|
|
57
57
|
def request_timeout: () -> Numeric
|
58
58
|
|
59
|
+
private
|
60
|
+
|
61
|
+
def initialize_body: (Options options) -> Transcoder::_Encoder?
|
62
|
+
|
59
63
|
class Body
|
60
64
|
@headers: Headers
|
61
65
|
@body: body_encoder?
|
data/sig/resolver/https.rbs
CHANGED
@@ -34,7 +34,9 @@ module HTTPX
|
|
34
34
|
|
35
35
|
def build_request: (String hostname) -> Request
|
36
36
|
|
37
|
-
def decode_response_body: (Response) ->
|
37
|
+
def decode_response_body: (Response) -> dns_decoding_response
|
38
|
+
|
39
|
+
def reset_hostname: (String hostname, ?reset_candidates: bool) -> Connection?
|
38
40
|
end
|
39
41
|
end
|
40
42
|
end
|
data/sig/resolver/native.rbs
CHANGED
@@ -11,7 +11,8 @@ module HTTPX
|
|
11
11
|
|
12
12
|
@options: Options
|
13
13
|
@ns_index: Integer
|
14
|
-
@nameserver: Array[String]
|
14
|
+
@nameserver: Array[String]
|
15
|
+
@socket_type: :udp | :tcp
|
15
16
|
@ndots: Integer
|
16
17
|
@start_timeout: Float?
|
17
18
|
@search: Array[String]
|
@@ -20,6 +21,8 @@ module HTTPX
|
|
20
21
|
@connections: Array[Connection]
|
21
22
|
@read_buffer: String
|
22
23
|
@write_buffer: Buffer
|
24
|
+
@large_packet: Buffer?
|
25
|
+
@io: UDP | TCP
|
23
26
|
|
24
27
|
attr_reader state: Symbol
|
25
28
|
|
@@ -54,11 +57,13 @@ module HTTPX
|
|
54
57
|
|
55
58
|
def generate_candidates: (String) -> Array[String]
|
56
59
|
|
57
|
-
def build_socket: () ->
|
60
|
+
def build_socket: () -> (UDP | TCP)
|
58
61
|
|
59
62
|
def transition: (Symbol nextstate) -> void
|
60
63
|
|
61
64
|
def handle_error: (NativeResolveError | StandardError) -> void
|
65
|
+
|
66
|
+
def reset_hostname: (String hostname, ?reset_candidates: bool) -> void
|
62
67
|
end
|
63
68
|
end
|
64
69
|
end
|
data/sig/resolver/resolver.rbs
CHANGED
data/sig/resolver/system.rbs
CHANGED
data/sig/resolver.rbs
CHANGED
@@ -2,8 +2,6 @@ module HTTPX
|
|
2
2
|
type ipaddr = IPAddr | String
|
3
3
|
|
4
4
|
module Resolver
|
5
|
-
extend Registry[Symbol, Class]
|
6
|
-
|
7
5
|
RESOLVE_TIMEOUT: Integer | Float
|
8
6
|
|
9
7
|
@lookup_mutex: Thread::Mutex
|
@@ -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
|
data/sig/response.rbs
CHANGED
@@ -41,14 +41,14 @@ module HTTPX
|
|
41
41
|
def initialize: (Request request, String | Integer status, String version, headers?) -> untyped
|
42
42
|
def no_data?: () -> bool
|
43
43
|
|
44
|
-
def decode:(
|
44
|
+
def decode:(Transcoder::_Decode transcoder, ?untyped options) -> untyped
|
45
45
|
|
46
46
|
class Body
|
47
47
|
include _Reader
|
48
48
|
include _ToS
|
49
49
|
include _ToStr
|
50
50
|
|
51
|
-
attr_reader encoding: String
|
51
|
+
attr_reader encoding: Encoding | String
|
52
52
|
|
53
53
|
@response: Response
|
54
54
|
@headers: Headers
|
@@ -108,10 +108,14 @@ module HTTPX
|
|
108
108
|
|
109
109
|
attr_reader request: Request
|
110
110
|
|
111
|
+
attr_reader response: Response?
|
112
|
+
|
111
113
|
def status: () -> (Integer | _ToS)
|
112
114
|
|
113
115
|
def uri: () -> URI::Generic
|
114
116
|
|
117
|
+
def close: () -> void
|
118
|
+
|
115
119
|
private
|
116
120
|
|
117
121
|
def initialize: (Request, Exception, options) -> untyped
|
data/sig/session.rbs
CHANGED
@@ -11,13 +11,11 @@ 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
|
private
|
23
21
|
|
@@ -27,7 +25,7 @@ module HTTPX
|
|
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?
|
31
29
|
|
32
30
|
def find_connection: (Request, Array[Connection] connections, Options options) -> Connection
|
33
31
|
|
@@ -35,18 +33,20 @@ module HTTPX
|
|
35
33
|
|
36
34
|
def build_altsvc_connection: (Connection existing_connection, Array[Connection] connections, URI::Generic alt_origin, String origin, Hash[String, String] alt_params, Options options) -> Connection?
|
37
35
|
|
38
|
-
def build_requests: (verb
|
39
|
-
| (Array[[verb
|
40
|
-
| (Array[[verb
|
41
|
-
| (verb
|
42
|
-
| (verb
|
36
|
+
def build_requests: (verb, uri, options) -> Array[Request]
|
37
|
+
| (Array[[verb, uri, options]], options) -> Array[Request]
|
38
|
+
| (Array[[verb, uri]], options) -> Array[Request]
|
39
|
+
| (verb, _Each[[uri, options]], Options) -> Array[Request]
|
40
|
+
| (verb, _Each[uri], options) -> Array[Request]
|
43
41
|
|
44
|
-
def build_connection: (URI::
|
42
|
+
def build_connection: (URI::HTTP | URI::HTTPS uri, Options options) -> Connection
|
45
43
|
|
46
44
|
def send_requests: (*Request) -> Array[response]
|
47
45
|
|
48
46
|
def _send_requests: (Array[Request]) -> Array[Connection]
|
49
47
|
|
50
48
|
def receive_requests: (Array[Request], Array[Connection]) -> Array[response]
|
49
|
+
|
50
|
+
attr_reader self.default_options: Options
|
51
51
|
end
|
52
52
|
end
|
data/sig/transcoder/xml.rbs
CHANGED
data/sig/transcoder.rbs
CHANGED
@@ -4,11 +4,6 @@ module HTTPX
|
|
4
4
|
type body_encoder = 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,6 +12,10 @@ 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)
|
22
21
|
end
|