httpx 1.4.3 → 1.5.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/1_4_4.md +14 -0
- data/doc/release_notes/1_5_0.md +126 -0
- data/lib/httpx/adapters/datadog.rb +24 -3
- data/lib/httpx/adapters/webmock.rb +3 -0
- data/lib/httpx/buffer.rb +16 -5
- data/lib/httpx/connection/http1.rb +8 -9
- data/lib/httpx/connection/http2.rb +48 -24
- data/lib/httpx/connection.rb +40 -20
- data/lib/httpx/errors.rb +2 -11
- data/lib/httpx/headers.rb +24 -23
- data/lib/httpx/io/ssl.rb +8 -4
- data/lib/httpx/io/tcp.rb +9 -7
- data/lib/httpx/io/unix.rb +1 -1
- data/lib/httpx/loggable.rb +13 -1
- data/lib/httpx/options.rb +63 -48
- data/lib/httpx/parser/http1.rb +1 -1
- data/lib/httpx/plugins/aws_sigv4.rb +1 -0
- data/lib/httpx/plugins/callbacks.rb +19 -6
- data/lib/httpx/plugins/circuit_breaker.rb +4 -3
- data/lib/httpx/plugins/cookies/jar.rb +0 -2
- data/lib/httpx/plugins/cookies/set_cookie_parser.rb +7 -4
- data/lib/httpx/plugins/cookies.rb +4 -4
- data/lib/httpx/plugins/follow_redirects.rb +4 -2
- data/lib/httpx/plugins/grpc/call.rb +1 -1
- data/lib/httpx/plugins/h2c.rb +7 -1
- data/lib/httpx/plugins/persistent.rb +22 -1
- data/lib/httpx/plugins/proxy/http.rb +3 -1
- data/lib/httpx/plugins/query.rb +35 -0
- data/lib/httpx/plugins/response_cache/file_store.rb +115 -15
- data/lib/httpx/plugins/response_cache/store.rb +7 -67
- data/lib/httpx/plugins/response_cache.rb +179 -29
- data/lib/httpx/plugins/retries.rb +27 -15
- data/lib/httpx/plugins/stream.rb +46 -20
- data/lib/httpx/plugins/stream_bidi.rb +315 -0
- data/lib/httpx/pool.rb +58 -5
- data/lib/httpx/request/body.rb +1 -1
- data/lib/httpx/request.rb +21 -5
- data/lib/httpx/resolver/https.rb +10 -4
- data/lib/httpx/resolver/native.rb +13 -13
- data/lib/httpx/resolver/resolver.rb +4 -0
- data/lib/httpx/resolver/system.rb +37 -14
- data/lib/httpx/resolver.rb +2 -2
- data/lib/httpx/response/body.rb +10 -21
- data/lib/httpx/response/buffer.rb +36 -12
- data/lib/httpx/response.rb +11 -1
- data/lib/httpx/selector.rb +16 -12
- data/lib/httpx/session.rb +80 -23
- data/lib/httpx/timers.rb +24 -16
- data/lib/httpx/transcoder/multipart/decoder.rb +4 -2
- data/lib/httpx/transcoder/multipart/encoder.rb +2 -1
- data/lib/httpx/version.rb +1 -1
- data/sig/buffer.rbs +1 -1
- data/sig/chainable.rbs +5 -2
- data/sig/connection/http2.rbs +11 -2
- data/sig/connection.rbs +4 -4
- data/sig/errors.rbs +0 -3
- data/sig/headers.rbs +15 -10
- data/sig/httpx.rbs +5 -1
- data/sig/io/tcp.rbs +6 -0
- data/sig/loggable.rbs +2 -0
- data/sig/options.rbs +7 -1
- data/sig/plugins/cookies/cookie.rbs +1 -3
- data/sig/plugins/cookies/jar.rbs +4 -4
- data/sig/plugins/cookies/set_cookie_parser.rbs +22 -0
- data/sig/plugins/cookies.rbs +2 -0
- data/sig/plugins/h2c.rbs +4 -0
- data/sig/plugins/proxy/http.rbs +3 -0
- data/sig/plugins/proxy.rbs +4 -0
- data/sig/plugins/response_cache/file_store.rbs +19 -0
- data/sig/plugins/response_cache/store.rbs +13 -0
- data/sig/plugins/response_cache.rbs +41 -19
- data/sig/plugins/retries.rbs +4 -3
- data/sig/plugins/stream.rbs +8 -1
- data/sig/plugins/stream_bidi.rbs +68 -0
- data/sig/plugins/upgrade/h2.rbs +9 -0
- data/sig/plugins/upgrade.rbs +5 -0
- data/sig/pool.rbs +5 -0
- data/sig/punycode.rbs +5 -0
- data/sig/request.rbs +7 -0
- data/sig/resolver/https.rbs +3 -2
- data/sig/resolver/native.rbs +1 -2
- data/sig/resolver/resolver.rbs +11 -3
- data/sig/resolver/system.rbs +19 -2
- data/sig/resolver.rbs +11 -7
- data/sig/response/body.rbs +3 -4
- data/sig/response/buffer.rbs +2 -3
- data/sig/response.rbs +2 -2
- data/sig/selector.rbs +20 -10
- data/sig/session.rbs +14 -6
- data/sig/timers.rbs +5 -7
- data/sig/transcoder/multipart.rbs +4 -3
- metadata +14 -5
- data/lib/httpx/session2.rb +0 -23
- data/lib/httpx/transcoder/utils/inflater.rb +0 -21
- data/sig/transcoder/utils/inflater.rbs +0 -12
@@ -0,0 +1,22 @@
|
|
1
|
+
module HTTPX
|
2
|
+
module Plugins::Cookies
|
3
|
+
module SetCookieParser
|
4
|
+
RE_WSP: Regexp
|
5
|
+
|
6
|
+
RE_NAME: Regexp
|
7
|
+
|
8
|
+
RE_BAD_CHAR: Regexp
|
9
|
+
|
10
|
+
RE_COOKIE_COMMA: Regexp
|
11
|
+
|
12
|
+
def self?.call: (String set_cookie) { (String name, String value, cookie_attributes attrs) -> void } -> void
|
13
|
+
|
14
|
+
def self?.scan_dquoted: (StringScanner scanner) -> String
|
15
|
+
|
16
|
+
def self?.scan_value: (StringScanner scanner, ?bool comma_as_separator) -> String
|
17
|
+
|
18
|
+
def self?.scan_name_value: (StringScanner scanner, ?bool comma_as_separator) -> [String?, String?]
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/sig/plugins/cookies.rbs
CHANGED
data/sig/plugins/h2c.rbs
CHANGED
data/sig/plugins/proxy/http.rbs
CHANGED
data/sig/plugins/proxy.rbs
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
module HTTPX
|
2
|
+
module Plugins
|
3
|
+
module ResponseCache
|
4
|
+
class FileStore
|
5
|
+
@dir: Pathname
|
6
|
+
|
7
|
+
include _ResponseCacheStore
|
8
|
+
|
9
|
+
def initialize: (?path dir) -> void
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def file_path: (cacheRequest request) -> Pathname
|
14
|
+
|
15
|
+
def read_from_file: (cacheRequest request, File f) -> cacheResponse?
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -3,47 +3,62 @@ module HTTPX
|
|
3
3
|
module ResponseCache
|
4
4
|
CACHEABLE_VERBS: Array[verb]
|
5
5
|
CACHEABLE_STATUS_CODES: Array[Integer]
|
6
|
+
SUPPORTED_VARY_HEADERS: Array[String]
|
6
7
|
|
7
|
-
def self?.
|
8
|
-
def self?.cacheable_response?: (::HTTPX::ErrorResponse | (Response & ResponseMethods) response) -> bool
|
9
|
-
def self?.cached_response?: (response response) -> bool
|
8
|
+
def self?.cacheable_response?: (::HTTPX::ErrorResponse | cacheResponse response) -> bool
|
10
9
|
|
11
|
-
|
12
|
-
@store: Hash[String, Array[Response]]
|
10
|
+
def self?.not_modified?: (response response) -> bool
|
13
11
|
|
14
|
-
|
12
|
+
interface _ResponseCacheOptions
|
13
|
+
def response_cache_store: () -> Store
|
15
14
|
|
16
|
-
def
|
17
|
-
|
18
|
-
def cached?: (Request request) -> boolish
|
19
|
-
|
20
|
-
def cache: (Request request, Response response) -> void
|
21
|
-
|
22
|
-
def prepare: (Request request) -> void
|
23
|
-
|
24
|
-
private
|
15
|
+
def supported_vary_headers: () -> Array[String]
|
16
|
+
end
|
25
17
|
|
26
|
-
|
18
|
+
interface _ResponseCacheStore
|
19
|
+
def get: (cacheRequest request) -> cacheResponse?
|
27
20
|
|
28
|
-
def
|
21
|
+
def set: (cacheRequest request, cacheResponse response) -> void
|
29
22
|
|
30
|
-
def
|
23
|
+
def clear: () -> void
|
31
24
|
end
|
32
25
|
|
33
26
|
module InstanceMethods
|
34
27
|
@response_cache: Store
|
35
28
|
|
36
29
|
def clear_response_cache: () -> void
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def prepare_cache: (cacheRequest request) -> void
|
34
|
+
|
35
|
+
def cacheable_request?: (cacheRequest request) -> bool
|
36
|
+
|
37
|
+
def match_by_vary?: (cacheRequest request, cacheResponse response) -> bool
|
37
38
|
end
|
38
39
|
|
39
40
|
module RequestMethods
|
41
|
+
attr_accessor cached_response: cacheResponse?
|
42
|
+
|
40
43
|
@response_cache_key: String
|
41
44
|
|
42
45
|
def response_cache_key: () -> String
|
46
|
+
|
47
|
+
def cacheable_verb?: () -> bool
|
43
48
|
end
|
44
49
|
|
45
50
|
module ResponseMethods
|
46
|
-
|
51
|
+
attr_writer original_request: cacheRequest
|
52
|
+
|
53
|
+
@cache: bool
|
54
|
+
|
55
|
+
def original_request: () -> cacheRequest?
|
56
|
+
|
57
|
+
def cached?: () -> bool
|
58
|
+
|
59
|
+
def mark_as_cached!: () -> void
|
60
|
+
|
61
|
+
def copy_from_cached!: () -> void
|
47
62
|
|
48
63
|
def fresh?: () -> bool
|
49
64
|
|
@@ -57,6 +72,13 @@ module HTTPX
|
|
57
72
|
|
58
73
|
def date: () -> Time
|
59
74
|
end
|
75
|
+
|
76
|
+
|
77
|
+
type cacheOptions = Options & _ResponseCacheOptions
|
78
|
+
|
79
|
+
type cacheRequest = Request & RequestMethods
|
80
|
+
|
81
|
+
type cacheResponse = Response & ResponseMethods
|
60
82
|
end
|
61
83
|
|
62
84
|
type sessionResponseCache = Session & ResponseCache::InstanceMethods
|
data/sig/plugins/retries.rbs
CHANGED
@@ -3,6 +3,7 @@ module HTTPX
|
|
3
3
|
module Retries
|
4
4
|
MAX_RETRIES: Integer
|
5
5
|
IDEMPOTENT_METHODS: Array[String]
|
6
|
+
RECONNECTABLE_ERRORS: Array[singleton(StandardError)]
|
6
7
|
RETRYABLE_ERRORS: Array[singleton(StandardError)]
|
7
8
|
DEFAULT_JITTER: ^(Numeric) -> Numeric
|
8
9
|
|
@@ -31,11 +32,11 @@ module HTTPX
|
|
31
32
|
|
32
33
|
def fetch_response: (retriesRequest request, Selector selector, retriesOptions options) -> (retriesResponse | ErrorResponse)?
|
33
34
|
|
34
|
-
def
|
35
|
+
def repeatable_request?: (retriesRequest request, retriesOptions options) -> boolish
|
35
36
|
|
36
|
-
def
|
37
|
+
def retryable_error?: (_Exception error) -> bool
|
37
38
|
|
38
|
-
def
|
39
|
+
def try_partial_retry: (retriesRequest request, (retriesResponse | ErrorResponse) response) -> void
|
39
40
|
|
40
41
|
end
|
41
42
|
|
data/sig/plugins/stream.rbs
CHANGED
@@ -16,6 +16,9 @@ module HTTPX
|
|
16
16
|
def stream: () -> StreamResponse?
|
17
17
|
end
|
18
18
|
|
19
|
+
module ResponseBodyMethods
|
20
|
+
@stream: StreamResponse?
|
21
|
+
end
|
19
22
|
end
|
20
23
|
|
21
24
|
type sessionStream = Session & Stream::InstanceMethods
|
@@ -26,8 +29,12 @@ module HTTPX
|
|
26
29
|
|
27
30
|
type streamRequest = Request & Plugins::Stream::RequestMethods
|
28
31
|
|
29
|
-
|
32
|
+
attr_reader request: streamRequest
|
33
|
+
@options: Options
|
34
|
+
|
30
35
|
@session: Plugins::sessionStream
|
36
|
+
@response_enum: Enumerator[String]?
|
37
|
+
@buffered_chunks: Array[String]
|
31
38
|
@on_chunk: ^(String) -> void | nil
|
32
39
|
|
33
40
|
def each: () { (String) -> void } -> void
|
@@ -0,0 +1,68 @@
|
|
1
|
+
module HTTPX
|
2
|
+
module Plugins
|
3
|
+
module StreamBidi
|
4
|
+
def self.load_dependencies: (singleton(Session)) -> void
|
5
|
+
|
6
|
+
def self.extra_options: (Options) -> (Options)
|
7
|
+
|
8
|
+
class HTTP2Bidi < Connection::HTTP2
|
9
|
+
@lock: Thread::Mutex
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def handle_stream: (::HTTP2::Stream stream, Request & RequestMethods request) -> void
|
14
|
+
|
15
|
+
def end_stream?: (Request & RequestMethods request, String? next_chunk) -> void
|
16
|
+
end
|
17
|
+
|
18
|
+
class BidiBuffer < Buffer
|
19
|
+
@parent_thread: Thread
|
20
|
+
@oob_mutex: Thread::Mutex
|
21
|
+
@oob_buffer: String
|
22
|
+
|
23
|
+
def rebuffer: () -> void
|
24
|
+
end
|
25
|
+
|
26
|
+
class Signal
|
27
|
+
@closed: bool
|
28
|
+
@pipe_read: ::IO
|
29
|
+
@pipe_write: ::IO
|
30
|
+
|
31
|
+
include _Selectable
|
32
|
+
|
33
|
+
def wakeup: () -> void
|
34
|
+
|
35
|
+
def mergeable?: () -> bool
|
36
|
+
|
37
|
+
def terminate: () -> void
|
38
|
+
end
|
39
|
+
|
40
|
+
module InstanceMethods
|
41
|
+
@signal: Signal
|
42
|
+
end
|
43
|
+
|
44
|
+
module RequestMethods
|
45
|
+
attr_accessor headers_sent: bool
|
46
|
+
|
47
|
+
@closed: bool
|
48
|
+
@mutex: Thread::Mutex
|
49
|
+
|
50
|
+
def closed?: () -> bool
|
51
|
+
end
|
52
|
+
|
53
|
+
module RequestBodyMethods
|
54
|
+
end
|
55
|
+
|
56
|
+
module ConnectionMethods
|
57
|
+
@write_buffer: BidiBuffer
|
58
|
+
|
59
|
+
private
|
60
|
+
|
61
|
+
def parser_type: (String protocol) -> (singleton(Connection::HTTP1) | singleton(Connection::HTTP2) | singleton(HTTP2Bidi))
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
type sessionStreamBidi = Session & StreamBidi::InstanceMethods
|
67
|
+
end
|
68
|
+
end
|
data/sig/plugins/upgrade.rbs
CHANGED
@@ -13,6 +13,9 @@ module HTTPX
|
|
13
13
|
|
14
14
|
def self.extra_options: (Options) -> (Options & _UpgradeOptions)
|
15
15
|
|
16
|
+
module InstanceMethods
|
17
|
+
end
|
18
|
+
|
16
19
|
module ConnectionMethods
|
17
20
|
attr_reader upgrade_protocol: String?
|
18
21
|
attr_reader hijacked: boolish
|
@@ -20,5 +23,7 @@ module HTTPX
|
|
20
23
|
def hijack_io: () -> void
|
21
24
|
end
|
22
25
|
end
|
26
|
+
|
27
|
+
type sessionUpgrade = Session & Upgrade::InstanceMethods
|
23
28
|
end
|
24
29
|
end
|
data/sig/pool.rbs
CHANGED
@@ -9,6 +9,7 @@ module HTTPX
|
|
9
9
|
|
10
10
|
type resolver_manager = Resolver::Multi | Resolver::System
|
11
11
|
|
12
|
+
@max_connections: Integer
|
12
13
|
@max_connections_per_origin: Integer
|
13
14
|
@pool_timeout: Numeric
|
14
15
|
@options: Options
|
@@ -16,6 +17,8 @@ module HTTPX
|
|
16
17
|
@resolver_mtx: Thread::Mutex
|
17
18
|
@connections: Hash[String, Array[Connection]]
|
18
19
|
@connection_mtx: Thread::Mutex
|
20
|
+
@connections_counter: Integer
|
21
|
+
@max_connections_cond: ConditionVariable
|
19
22
|
@origin_counters: Hash[String, Integer]
|
20
23
|
@origin_conds: Hash[String, ConditionVariable]
|
21
24
|
|
@@ -42,5 +45,7 @@ module HTTPX
|
|
42
45
|
def checkout_new_connection: (http_uri uri, Options options) -> Connection
|
43
46
|
|
44
47
|
def checkout_new_resolver: (Class resolver_type, Options options) -> resolver_manager
|
48
|
+
|
49
|
+
def drop_connection: (?Connection connection) -> Connection?
|
45
50
|
end
|
46
51
|
end
|
data/sig/punycode.rbs
ADDED
data/sig/request.rbs
CHANGED
@@ -20,6 +20,7 @@ module HTTPX
|
|
20
20
|
|
21
21
|
attr_writer persistent: bool
|
22
22
|
|
23
|
+
@ping: bool
|
23
24
|
@query_params: Hash[interned, untyped]?
|
24
25
|
@trailers: Headers?
|
25
26
|
@informational_status: Integer?
|
@@ -28,12 +29,18 @@ module HTTPX
|
|
28
29
|
|
29
30
|
def initialize: (Symbol | String verb, generic_uri uri, Options options, ?request_params params) -> untyped
|
30
31
|
|
32
|
+
def ping?: () -> bool
|
33
|
+
|
34
|
+
def ping!: () -> void
|
35
|
+
|
31
36
|
def empty?: () -> bool
|
32
37
|
|
33
38
|
def close: () -> void
|
34
39
|
|
35
40
|
def interests: () -> (:r | :w)
|
36
41
|
|
42
|
+
def can_buffer? : () -> bool
|
43
|
+
|
37
44
|
def merge_headers: (_Each[[String, headers_value]]) -> void
|
38
45
|
|
39
46
|
def scheme: () -> String
|
data/sig/resolver/https.rbs
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
module HTTPX
|
2
2
|
module Resolver
|
3
3
|
class HTTPS < Resolver
|
4
|
+
extend Forwardable
|
5
|
+
|
4
6
|
NAMESERVER: String
|
5
7
|
|
6
8
|
DEFAULTS: Hash[Symbol, untyped]
|
@@ -9,6 +11,7 @@ module HTTPX
|
|
9
11
|
attr_reader family: ip_family
|
10
12
|
|
11
13
|
@options: Options
|
14
|
+
@queries: Hash[String, Connection]
|
12
15
|
@requests: Hash[Request, String]
|
13
16
|
@connections: Array[Connection]
|
14
17
|
@uri: http_uri
|
@@ -26,8 +29,6 @@ module HTTPX
|
|
26
29
|
|
27
30
|
def resolver_connection: () -> Connection
|
28
31
|
|
29
|
-
def resolve: (?Connection connection, ?String? hostname) -> void
|
30
|
-
|
31
32
|
def on_response: (Request, response) -> void
|
32
33
|
|
33
34
|
def parse: (Request request, Response response) -> void
|
data/sig/resolver/native.rbs
CHANGED
@@ -16,6 +16,7 @@ module HTTPX
|
|
16
16
|
@search: Array[String]
|
17
17
|
@_timeouts: Array[Numeric]
|
18
18
|
@timeouts: Hash[String, Array[Numeric]]
|
19
|
+
@queries: Hash[String, Connection]
|
19
20
|
@connections: Array[Connection]
|
20
21
|
@read_buffer: String
|
21
22
|
@write_buffer: Buffer
|
@@ -54,8 +55,6 @@ module HTTPX
|
|
54
55
|
|
55
56
|
def parse: (String) -> void
|
56
57
|
|
57
|
-
def resolve: (?Connection connection, ?String hostname) -> void
|
58
|
-
|
59
58
|
def generate_candidates: (String) -> Array[String]
|
60
59
|
|
61
60
|
def build_socket: () -> (UDP | TCP)
|
data/sig/resolver/resolver.rbs
CHANGED
@@ -4,7 +4,11 @@ module HTTPX
|
|
4
4
|
include Callbacks
|
5
5
|
include Loggable
|
6
6
|
|
7
|
-
|
7
|
+
include _Selectable
|
8
|
+
|
9
|
+
RECORD_TYPES: Hash[ip_family, singleton(Resolv::DNS::Resource)]
|
10
|
+
|
11
|
+
FAMILY_TYPES: Hash[singleton(Resolv::DNS::Resource), String]
|
8
12
|
|
9
13
|
attr_reader family: ip_family
|
10
14
|
|
@@ -18,8 +22,8 @@ module HTTPX
|
|
18
22
|
|
19
23
|
@record_type: singleton(Resolv::DNS::Resource)
|
20
24
|
@resolver_options: Hash[Symbol, untyped]
|
21
|
-
@queries: Hash[String, Connection]
|
22
25
|
@system_resolver: Resolv::Hosts
|
26
|
+
@connections: Array[Connection]
|
23
27
|
|
24
28
|
def close: () -> void
|
25
29
|
|
@@ -33,11 +37,15 @@ module HTTPX
|
|
33
37
|
|
34
38
|
def emit_addresses: (Connection connection, ip_family family, Array[IPAddr], ?bool early_resolve) -> void
|
35
39
|
|
40
|
+
def self.multi?: () -> bool
|
41
|
+
|
36
42
|
private
|
37
43
|
|
44
|
+
def resolve: (?Connection connection, ?String hostname) -> void
|
45
|
+
|
38
46
|
def emit_resolved_connection: (Connection connection, Array[IPAddr] addresses, bool early_resolve) -> void
|
39
47
|
|
40
|
-
def initialize: (ip_family
|
48
|
+
def initialize: (ip_family family, Options options) -> void
|
41
49
|
|
42
50
|
def early_resolve: (Connection connection, ?hostname: String) -> bool
|
43
51
|
|
data/sig/resolver/system.rbs
CHANGED
@@ -2,16 +2,33 @@ module HTTPX
|
|
2
2
|
module Resolver
|
3
3
|
class System < Resolver
|
4
4
|
RESOLV_ERRORS: Array[singleton(StandardError)] # ResolvError
|
5
|
+
DONE: 1
|
6
|
+
ERROR: 2
|
5
7
|
|
6
8
|
@resolver: Resolv::DNS
|
9
|
+
@_timeouts: Array[Numeric]
|
10
|
+
@timeouts: Hash[String, Array[Numeric]]
|
11
|
+
@queries: Array[[ip_family, Connection]]
|
12
|
+
@ips: Array[[ip_family, Connection, (Array[Addrinfo] | StandardError)]]
|
13
|
+
@pipe_mutex: Thread::Mutex
|
14
|
+
@pipe_read: ::IO
|
15
|
+
@pipe_write: ::IO
|
7
16
|
|
8
|
-
attr_reader
|
17
|
+
attr_reader state: Symbol
|
9
18
|
|
10
19
|
def <<: (Connection) -> void
|
11
20
|
|
12
21
|
private
|
13
22
|
|
14
|
-
def
|
23
|
+
def transition: (Symbol nextstate) -> void
|
24
|
+
|
25
|
+
def consume: () -> void
|
26
|
+
|
27
|
+
def async_resolve: (Connection connection, String hostname, String scheme) -> void
|
28
|
+
|
29
|
+
def __addrinfo_resolve: (String host, String scheme) -> Array[Addrinfo]
|
30
|
+
|
31
|
+
def initialize: (Options options) -> void
|
15
32
|
end
|
16
33
|
end
|
17
34
|
end
|
data/sig/resolver.rbs
CHANGED
@@ -2,22 +2,26 @@ module HTTPX
|
|
2
2
|
type ipaddr = IPAddr | String
|
3
3
|
|
4
4
|
module Resolver
|
5
|
-
RESOLVE_TIMEOUT: Array[Integer]
|
6
|
-
|
7
|
-
@lookup_mutex: Thread::Mutex
|
8
|
-
|
9
5
|
type dns_resource = singleton(Resolv::DNS::Resource)
|
10
6
|
|
11
7
|
type dns_result = { "name" => String, "TTL" => Numeric, "alias" => String }
|
12
8
|
| { "name" => String, "TTL" => Numeric, "data" => String }
|
13
9
|
|
10
|
+
RESOLVE_TIMEOUT: Array[Integer]
|
11
|
+
|
12
|
+
self.@lookup_mutex: Thread::Mutex
|
13
|
+
self.@lookups: Hash[String, Array[dns_result]]
|
14
|
+
self.@identifier_mutex: Thread::Mutex
|
15
|
+
self.@identifier: Integer
|
16
|
+
self.@system_resolver: Resolv::Hosts
|
17
|
+
|
14
18
|
type dns_decoding_response = [:ok, Array[dns_result]] | [:decode_error, Resolv::DNS::DecodeError] | [:dns_error, Integer] | Symbol
|
15
19
|
|
16
|
-
def nolookup_resolve: (String hostname) -> Array[IPAddr]
|
20
|
+
def self?.nolookup_resolve: (String hostname) -> Array[IPAddr]?
|
17
21
|
|
18
|
-
def ip_resolve: (String hostname) -> Array[IPAddr]?
|
22
|
+
def self?.ip_resolve: (String hostname) -> Array[IPAddr]?
|
19
23
|
|
20
|
-
def system_resolve: (String hostname) -> Array[IPAddr]?
|
24
|
+
def self?.system_resolve: (String hostname) -> Array[IPAddr]?
|
21
25
|
|
22
26
|
def self?.resolver_for: (:native resolver_type) -> singleton(Native) |
|
23
27
|
(:system resolver_type) -> singleton(System) |
|
data/sig/response/body.rbs
CHANGED
@@ -7,14 +7,15 @@ module HTTPX
|
|
7
7
|
attr_reader encoding: Encoding
|
8
8
|
attr_reader encodings: Array[String]
|
9
9
|
|
10
|
+
attr_reader buffer: Response::Buffer?
|
11
|
+
|
10
12
|
@response: Response
|
11
13
|
@headers: Headers
|
12
14
|
@options: Options
|
13
15
|
@state: :idle | :memory | :buffer | :closed
|
14
16
|
@window_size: Integer
|
15
17
|
@length: Integer
|
16
|
-
@
|
17
|
-
@reader: StringIO | Tempfile | nil
|
18
|
+
@reader: Response::Buffer?
|
18
19
|
@inflaters: Array[Transcoder::_Inflater]
|
19
20
|
|
20
21
|
def initialize: (Response, Options) -> void
|
@@ -47,7 +48,5 @@ module HTTPX
|
|
47
48
|
def decode_chunk: (String chunk) -> String
|
48
49
|
|
49
50
|
def transition: (Symbol nextstate) -> void
|
50
|
-
|
51
|
-
def _with_same_buffer_pos: [A] () { () -> A } -> A
|
52
51
|
end
|
53
52
|
end
|
data/sig/response/buffer.rbs
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
module HTTPX
|
2
2
|
class Response::Buffer
|
3
|
+
attr_reader buffer: StringIO | Tempfile
|
4
|
+
|
3
5
|
@threshold_size: Integer
|
4
6
|
@bytesize: Integer
|
5
7
|
@encoding: Encoding
|
6
|
-
@buffer: StringIO | Tempfile
|
7
8
|
|
8
9
|
def initialize: (threshold_size: Integer, ?bytesize: Integer, ?encoding: Encoding) -> void
|
9
10
|
|
@@ -18,7 +19,5 @@ module HTTPX
|
|
18
19
|
private
|
19
20
|
|
20
21
|
def try_upgrade_buffer: () -> void
|
21
|
-
|
22
|
-
def _with_same_buffer_pos: () { () -> void } -> void
|
23
22
|
end
|
24
23
|
end
|
data/sig/response.rbs
CHANGED
@@ -4,6 +4,8 @@ module HTTPX
|
|
4
4
|
|
5
5
|
def finished?: () -> bool
|
6
6
|
|
7
|
+
def finish!: () -> void
|
8
|
+
|
7
9
|
def raise_for_status: () -> self
|
8
10
|
|
9
11
|
def error: () -> StandardError?
|
@@ -41,8 +43,6 @@ module HTTPX
|
|
41
43
|
|
42
44
|
def content_type: () -> ContentType
|
43
45
|
|
44
|
-
def finish!: () -> void
|
45
|
-
|
46
46
|
def complete?: () -> bool
|
47
47
|
|
48
48
|
def json: (?JSON::options opts) -> untyped
|
data/sig/selector.rbs
CHANGED
@@ -1,15 +1,27 @@
|
|
1
1
|
module HTTPX
|
2
|
-
|
2
|
+
interface _Selectable
|
3
|
+
def state: () -> Symbol
|
4
|
+
|
5
|
+
def to_io: () -> ::IO
|
6
|
+
|
7
|
+
def call: () -> void
|
8
|
+
|
9
|
+
def interests: () -> io_interests?
|
10
|
+
|
11
|
+
def timeout: () -> Numeric?
|
12
|
+
|
13
|
+
def handle_socket_timeout: (Numeric interval) -> void
|
14
|
+
end
|
3
15
|
|
4
16
|
class Selector
|
5
|
-
include _Each[
|
17
|
+
include _Each[_Selectable]
|
6
18
|
|
7
19
|
READABLE: Array[Symbol]
|
8
20
|
WRITABLE: Array[Symbol]
|
9
21
|
|
10
22
|
@timers: Timers
|
11
23
|
|
12
|
-
@selectables: Array[
|
24
|
+
@selectables: Array[_Selectable]
|
13
25
|
@is_timer_interval: bool
|
14
26
|
|
15
27
|
def next_tick: () -> void
|
@@ -27,23 +39,21 @@ module HTTPX
|
|
27
39
|
|
28
40
|
def empty?: () -> bool
|
29
41
|
|
30
|
-
def register: (
|
42
|
+
def register: (_Selectable io) -> void
|
31
43
|
|
32
|
-
def deregister: (
|
44
|
+
def deregister: (_Selectable io) -> _Selectable?
|
33
45
|
|
34
46
|
private
|
35
47
|
|
36
48
|
def initialize: () -> void
|
37
49
|
|
38
|
-
def select: (Numeric? interval) { (
|
50
|
+
def select: (Numeric? interval) { (_Selectable) -> void } -> void
|
39
51
|
|
40
|
-
def select_many: (Numeric? interval) { (
|
52
|
+
def select_many: (Numeric? interval) { (_Selectable) -> void } -> void
|
41
53
|
|
42
|
-
def select_one: (Numeric? interval) { (
|
54
|
+
def select_one: (Numeric? interval) { (_Selectable) -> void } -> void
|
43
55
|
|
44
56
|
def next_timeout: () -> Numeric?
|
45
|
-
|
46
|
-
def emit_error: (StandardError e) -> void
|
47
57
|
end
|
48
58
|
|
49
59
|
type io_interests = :r | :w | :rw
|