httpx 0.9.0 → 0.11.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 +48 -0
- data/README.md +13 -3
- data/doc/release_notes/0_10_0.md +66 -0
- data/doc/release_notes/0_10_1.md +37 -0
- data/doc/release_notes/0_10_2.md +5 -0
- data/doc/release_notes/0_11_0.md +76 -0
- data/doc/release_notes/0_11_1.md +1 -0
- data/lib/httpx.rb +2 -0
- data/lib/httpx/adapters/datadog.rb +205 -0
- data/lib/httpx/adapters/faraday.rb +1 -3
- data/lib/httpx/adapters/webmock.rb +123 -0
- data/lib/httpx/chainable.rb +10 -9
- data/lib/httpx/connection.rb +7 -24
- data/lib/httpx/connection/http1.rb +15 -2
- data/lib/httpx/connection/http2.rb +15 -16
- data/lib/httpx/domain_name.rb +438 -0
- data/lib/httpx/errors.rb +4 -1
- data/lib/httpx/extensions.rb +21 -1
- data/lib/httpx/headers.rb +1 -0
- data/lib/httpx/io/ssl.rb +4 -9
- data/lib/httpx/io/tcp.rb +6 -5
- data/lib/httpx/io/udp.rb +8 -4
- data/lib/httpx/options.rb +2 -0
- data/lib/httpx/parser/http1.rb +14 -17
- data/lib/httpx/plugins/compression.rb +28 -63
- data/lib/httpx/plugins/compression/brotli.rb +10 -14
- data/lib/httpx/plugins/compression/deflate.rb +7 -6
- data/lib/httpx/plugins/compression/gzip.rb +23 -5
- data/lib/httpx/plugins/cookies.rb +21 -60
- data/lib/httpx/plugins/cookies/cookie.rb +173 -0
- data/lib/httpx/plugins/cookies/jar.rb +74 -0
- data/lib/httpx/plugins/cookies/set_cookie_parser.rb +142 -0
- data/lib/httpx/plugins/expect.rb +34 -11
- data/lib/httpx/plugins/follow_redirects.rb +20 -2
- data/lib/httpx/plugins/h2c.rb +1 -1
- data/lib/httpx/plugins/multipart.rb +41 -30
- data/lib/httpx/plugins/multipart/encoder.rb +115 -0
- data/lib/httpx/plugins/multipart/mime_type_detector.rb +64 -0
- data/lib/httpx/plugins/multipart/part.rb +34 -0
- data/lib/httpx/plugins/persistent.rb +6 -1
- data/lib/httpx/plugins/proxy.rb +16 -2
- data/lib/httpx/plugins/proxy/socks4.rb +14 -14
- data/lib/httpx/plugins/proxy/socks5.rb +3 -2
- data/lib/httpx/plugins/push_promise.rb +2 -2
- data/lib/httpx/plugins/rate_limiter.rb +51 -0
- data/lib/httpx/plugins/retries.rb +3 -2
- data/lib/httpx/plugins/stream.rb +109 -13
- data/lib/httpx/pool.rb +14 -20
- data/lib/httpx/request.rb +29 -31
- data/lib/httpx/resolver.rb +7 -6
- data/lib/httpx/resolver/https.rb +25 -25
- data/lib/httpx/resolver/native.rb +29 -22
- data/lib/httpx/resolver/resolver_mixin.rb +4 -2
- data/lib/httpx/resolver/system.rb +3 -3
- data/lib/httpx/response.rb +16 -23
- data/lib/httpx/selector.rb +11 -17
- data/lib/httpx/session.rb +39 -30
- data/lib/httpx/transcoder.rb +20 -0
- data/lib/httpx/transcoder/chunker.rb +0 -2
- data/lib/httpx/transcoder/form.rb +9 -7
- data/lib/httpx/transcoder/json.rb +0 -4
- data/lib/httpx/utils.rb +45 -0
- data/lib/httpx/version.rb +1 -1
- data/sig/buffer.rbs +24 -0
- data/sig/callbacks.rbs +14 -0
- data/sig/chainable.rbs +37 -0
- data/sig/connection.rbs +85 -0
- data/sig/connection/http1.rbs +66 -0
- data/sig/connection/http2.rbs +77 -0
- data/sig/domain_name.rbs +17 -0
- data/sig/errors.rbs +3 -0
- data/sig/headers.rbs +45 -0
- data/sig/httpx.rbs +15 -0
- data/sig/loggable.rbs +11 -0
- data/sig/options.rbs +118 -0
- data/sig/parser/http1.rbs +50 -0
- data/sig/plugins/authentication.rbs +11 -0
- data/sig/plugins/basic_authentication.rbs +13 -0
- data/sig/plugins/compression.rbs +55 -0
- data/sig/plugins/compression/brotli.rbs +21 -0
- data/sig/plugins/compression/deflate.rbs +17 -0
- data/sig/plugins/compression/gzip.rbs +29 -0
- data/sig/plugins/cookies.rbs +26 -0
- data/sig/plugins/cookies/cookie.rbs +50 -0
- data/sig/plugins/cookies/jar.rbs +27 -0
- data/sig/plugins/digest_authentication.rbs +33 -0
- data/sig/plugins/expect.rbs +19 -0
- data/sig/plugins/follow_redirects.rbs +37 -0
- data/sig/plugins/h2c.rbs +26 -0
- data/sig/plugins/multipart.rbs +44 -0
- data/sig/plugins/persistent.rbs +17 -0
- data/sig/plugins/proxy.rbs +47 -0
- data/sig/plugins/proxy/http.rbs +14 -0
- data/sig/plugins/proxy/socks4.rbs +33 -0
- data/sig/plugins/proxy/socks5.rbs +36 -0
- data/sig/plugins/proxy/ssh.rbs +18 -0
- data/sig/plugins/push_promise.rbs +22 -0
- data/sig/plugins/rate_limiter.rbs +11 -0
- data/sig/plugins/retries.rbs +48 -0
- data/sig/plugins/stream.rbs +39 -0
- data/sig/pool.rbs +36 -0
- data/sig/registry.rbs +9 -0
- data/sig/request.rbs +61 -0
- data/sig/resolver.rbs +26 -0
- data/sig/resolver/https.rbs +51 -0
- data/sig/resolver/native.rbs +60 -0
- data/sig/resolver/resolver_mixin.rbs +27 -0
- data/sig/resolver/system.rbs +17 -0
- data/sig/response.rbs +87 -0
- data/sig/selector.rbs +20 -0
- data/sig/session.rbs +49 -0
- data/sig/timeout.rbs +29 -0
- data/sig/transcoder.rbs +18 -0
- data/sig/transcoder/body.rbs +20 -0
- data/sig/transcoder/chunker.rbs +32 -0
- data/sig/transcoder/form.rbs +22 -0
- data/sig/transcoder/json.rbs +16 -0
- metadata +99 -59
- data/lib/httpx/resolver/options.rb +0 -25
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module HTTPX
|
|
2
|
+
module Plugins
|
|
3
|
+
module Persistent
|
|
4
|
+
def self.load_dependencies: (singleton(Session)) -> void
|
|
5
|
+
|
|
6
|
+
interface _PersistentOptions
|
|
7
|
+
def persistent: () -> bool?
|
|
8
|
+
def persistent=: (bool) -> bool
|
|
9
|
+
def with_persistent: (bool) -> instance
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def self.extra_options: (Options) -> (Options & _PersistentOptions)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
type sessionPersistent = sessionFollowRedirects
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
module HTTPX
|
|
2
|
+
HTTPProxyError: singleton(Error)
|
|
3
|
+
|
|
4
|
+
module Plugins
|
|
5
|
+
module Proxy
|
|
6
|
+
Error: singleton(HTTPProxyError)
|
|
7
|
+
PROXY_ERRORS: Array[singleton(StandardError)]
|
|
8
|
+
|
|
9
|
+
class Parameters
|
|
10
|
+
attr_reader uri: URI::Generic
|
|
11
|
+
attr_reader username: string?
|
|
12
|
+
attr_reader password: string?
|
|
13
|
+
|
|
14
|
+
def authenticated?: () -> boolish
|
|
15
|
+
def token_authentication: () -> String?
|
|
16
|
+
|
|
17
|
+
def ==: (untyped) -> bool
|
|
18
|
+
|
|
19
|
+
private
|
|
20
|
+
|
|
21
|
+
def initialize: (uri: generic_uri, ?username: string, ?password: string) -> untyped
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def self.configure: (singleton(Session)) -> void
|
|
25
|
+
|
|
26
|
+
type proxyParam = Parameters | Hash
|
|
27
|
+
|
|
28
|
+
interface _ProxyOptions
|
|
29
|
+
def proxy: () -> proxyParam?
|
|
30
|
+
def proxy=: (Parameters | _ToHash) -> proxyParam
|
|
31
|
+
def with_proxy: (Parameters | _ToHash) -> instance
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def self.extra_options: (Options) -> (Options & _ProxyOptions)
|
|
35
|
+
|
|
36
|
+
module InstanceMethods
|
|
37
|
+
private
|
|
38
|
+
|
|
39
|
+
def proxy_uris: (uri, Options & _ProxyOptions) -> { uri: (URI | string), username: string, password: string }
|
|
40
|
+
| (uri, Options & _ProxyOptions) -> { uri: (URI | string) }
|
|
41
|
+
| (uri, Options & _ProxyOptions) -> nil
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
type sessionProxy = Session & Plugins::Proxy::InstanceMethods
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
module HTTPX
|
|
2
|
+
Socks4Error: singleton(Error)
|
|
3
|
+
|
|
4
|
+
module Plugins
|
|
5
|
+
module Proxy
|
|
6
|
+
module Socks4
|
|
7
|
+
|
|
8
|
+
module ConnectionMethods
|
|
9
|
+
def __socks4_proxy_connect: () -> void
|
|
10
|
+
def __socks4_on_packet: (String packet) -> void
|
|
11
|
+
def on_socks4_error: (string) -> void
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
class SocksParser
|
|
15
|
+
include Callbacks
|
|
16
|
+
|
|
17
|
+
def close: () -> void
|
|
18
|
+
def consume: (*untyped) -> void
|
|
19
|
+
def empty: () -> bool
|
|
20
|
+
def <<: (string) -> void
|
|
21
|
+
|
|
22
|
+
private
|
|
23
|
+
|
|
24
|
+
def initialize: (Buffer buffer, Options) -> untyped
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
module Packet
|
|
28
|
+
def self?.connect: (Parameters, uri) -> String
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
module HTTPX
|
|
2
|
+
Socks5Error: singleton(Error)
|
|
3
|
+
|
|
4
|
+
module Plugins
|
|
5
|
+
module Proxy
|
|
6
|
+
module Socks5
|
|
7
|
+
|
|
8
|
+
module ConnectionMethods
|
|
9
|
+
def __socks5_proxy_connect: () -> void
|
|
10
|
+
def __socks5_on_packet: (String packet) -> void
|
|
11
|
+
def __socks5_check_version: (int) -> void
|
|
12
|
+
def __on_socks5_error: (string) -> void
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
class SocksParser
|
|
16
|
+
include Callbacks
|
|
17
|
+
|
|
18
|
+
def close: () -> void
|
|
19
|
+
def consume: (*untyped) -> void
|
|
20
|
+
def empty: () -> bool
|
|
21
|
+
def <<: (string) -> void
|
|
22
|
+
|
|
23
|
+
private
|
|
24
|
+
|
|
25
|
+
def initialize: (Buffer buffer, Options) -> untyped
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
module Packet
|
|
29
|
+
def self?.negotiate: (Parameters) -> String
|
|
30
|
+
def self?.authenticate: (Parameters) -> String
|
|
31
|
+
def self?.connect: (uri) -> String
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module HTTPX
|
|
2
|
+
module Plugins
|
|
3
|
+
module Proxy
|
|
4
|
+
module SSH
|
|
5
|
+
def self.load_dependencies: (singleton(Session)) -> void
|
|
6
|
+
|
|
7
|
+
module InstancenMethods
|
|
8
|
+
private
|
|
9
|
+
|
|
10
|
+
def build_gateway_socket: (int, URI::HTTPS | URI::HTTPS, Options) -> IO
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
type sessionSSHProxy = Plugins::Proxy::InstanceMethods & Plugins::Proxy::SSH::InstanceMethods
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
module HTTPX
|
|
2
|
+
module Plugins
|
|
3
|
+
module PushPromise
|
|
4
|
+
def self.extra_options: (Options) -> Options
|
|
5
|
+
|
|
6
|
+
module ResponseMethods
|
|
7
|
+
def pushed?: () -> boolish
|
|
8
|
+
def mark_as_pushed!: () -> void
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
module InstanceMethods
|
|
12
|
+
private
|
|
13
|
+
|
|
14
|
+
def promise_headers: () -> Hash[HTTP2Next::Stream, Request]
|
|
15
|
+
def __on_promise_request: (Connection::HTTP2, HTTP2Next::Stream, headers_input) -> void
|
|
16
|
+
def __on_promise_response: (Connection::HTTP2, HTTP2Next::Stream, headers_input) -> void
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
type sessionPushPromise = Session & PushPromise::InstanceMethods
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
module HTTPX
|
|
2
|
+
module Plugins
|
|
3
|
+
module RateLimiter
|
|
4
|
+
def self.load_dependencies: (singleton(Session)) -> void
|
|
5
|
+
|
|
6
|
+
def self.retry_on_rate_limited_response: (_Response) -> bool
|
|
7
|
+
|
|
8
|
+
def self.retry_after_rate_limit: (untyped, _Response) -> Numeric?
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
module HTTPX
|
|
2
|
+
module Plugins
|
|
3
|
+
module Retries
|
|
4
|
+
MAX_RETRIES: Integer
|
|
5
|
+
IDEMPOTENT_METHODS: Array[verb]
|
|
6
|
+
RETRYABLE_ERRORS: Array[singleton(StandardError)]
|
|
7
|
+
|
|
8
|
+
interface _RetryCallback
|
|
9
|
+
def call: (response) -> bool?
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
interface _RetriesOptions
|
|
13
|
+
def retry_after: () -> Numeric?
|
|
14
|
+
def retry_after=: (Numeric) -> Numeric
|
|
15
|
+
def with_retry_after: (Numeric) -> instance
|
|
16
|
+
|
|
17
|
+
def max_retries: () -> Integer?
|
|
18
|
+
def max_retries=: (int) -> Integer
|
|
19
|
+
def with_max_retries: (int) -> instance
|
|
20
|
+
|
|
21
|
+
def retry_change_requests: () -> bool?
|
|
22
|
+
def retry_change_requests=: (bool) -> bool
|
|
23
|
+
def with_retry_change_requests: (bool) -> instance
|
|
24
|
+
|
|
25
|
+
def retry_on: () -> _RetryCallback?
|
|
26
|
+
def retry_on=: (_RetryCallback) -> _RetryCallback
|
|
27
|
+
def with_retry_on: (_RetryCallback) -> instance
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def self.extra_options: (Options) -> (Options & _RetriesOptions)
|
|
31
|
+
|
|
32
|
+
module InstanceMethods
|
|
33
|
+
def max_retries: (int) -> instance
|
|
34
|
+
|
|
35
|
+
private
|
|
36
|
+
|
|
37
|
+
def __repeatable_request?: (Request, Options) -> boolish
|
|
38
|
+
def __retryable_error?: (_Exception) -> bool
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
module RequestMethods
|
|
42
|
+
def retries: () -> Integer
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
type sessionRetries = Session & Plugins::Retries::InstanceMethods
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
module HTTPX
|
|
2
|
+
module Plugins
|
|
3
|
+
module Stream
|
|
4
|
+
module InstanceMethods
|
|
5
|
+
private
|
|
6
|
+
|
|
7
|
+
def request: (*Request, ?stream: bool, **untyped?) -> (response | Array[response] | StreamResponse)
|
|
8
|
+
| (*untyped, ?stream: bool, **untyped?) -> (response | Array[response] | StreamResponse)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
module RequestMethods
|
|
12
|
+
attr_accessor stream: StreamResponse?
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
module ResponseMethods
|
|
16
|
+
def stream: () -> StreamResponse?
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
class StreamResponse
|
|
20
|
+
include _ToS
|
|
21
|
+
|
|
22
|
+
def each: () { (String) -> void } -> void
|
|
23
|
+
| () -> Enumerable[String]
|
|
24
|
+
|
|
25
|
+
def each_line: () { (String) -> void } -> void
|
|
26
|
+
| () -> Enumerable[String]
|
|
27
|
+
|
|
28
|
+
def on_chunk: (string) -> void
|
|
29
|
+
|
|
30
|
+
private
|
|
31
|
+
|
|
32
|
+
def response: () -> response
|
|
33
|
+
def initialize: (Request, Session) -> untyped
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
type sessionStream = Session & Plugins::Stream::InstanceMethods
|
|
38
|
+
end
|
|
39
|
+
end
|
data/sig/pool.rbs
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
module HTTPX
|
|
2
|
+
class Pool
|
|
3
|
+
def empty?: () -> void
|
|
4
|
+
|
|
5
|
+
def next_tick: () -> void
|
|
6
|
+
|
|
7
|
+
def close: (Array[Connection]) -> void
|
|
8
|
+
| () -> void
|
|
9
|
+
|
|
10
|
+
def init_connection: (Connection, Options) -> void
|
|
11
|
+
|
|
12
|
+
def find_connection: (generic_uri, Options) -> Connection?
|
|
13
|
+
|
|
14
|
+
private
|
|
15
|
+
|
|
16
|
+
def initialize: () -> untyped
|
|
17
|
+
|
|
18
|
+
def resolve_connection: (Connection) -> void
|
|
19
|
+
|
|
20
|
+
def on_resolver_connection: (Connection) -> void
|
|
21
|
+
|
|
22
|
+
def on_resolver_error: (Connection, StandardError) -> void
|
|
23
|
+
|
|
24
|
+
def on_resolver_close: (resolver) -> void
|
|
25
|
+
|
|
26
|
+
def register_connection: (Connection) -> void
|
|
27
|
+
|
|
28
|
+
def unregister_connection: (Connection) -> void
|
|
29
|
+
|
|
30
|
+
def coalesce_connections: (Connection, Connection) -> void
|
|
31
|
+
|
|
32
|
+
def next_timeout: () -> Numeric?
|
|
33
|
+
|
|
34
|
+
def find_resolver_for: (Connection) -> resolver
|
|
35
|
+
end
|
|
36
|
+
end
|
data/sig/registry.rbs
ADDED
data/sig/request.rbs
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
module HTTPX
|
|
2
|
+
class Request
|
|
3
|
+
include Callbacks
|
|
4
|
+
|
|
5
|
+
METHODS: Array[verb]
|
|
6
|
+
USER_AGENT: String
|
|
7
|
+
|
|
8
|
+
attr_reader verb: verb
|
|
9
|
+
attr_reader uri: URI::HTTP | URI::HTTPS
|
|
10
|
+
attr_reader headers: Headers
|
|
11
|
+
attr_reader body: Body
|
|
12
|
+
attr_reader state: Symbol
|
|
13
|
+
attr_reader options: Options
|
|
14
|
+
attr_reader response: Response?
|
|
15
|
+
|
|
16
|
+
def initialize: (verb | String, uri, ?options?) -> untyped
|
|
17
|
+
|
|
18
|
+
def interests: () -> (:r | :w)
|
|
19
|
+
|
|
20
|
+
def merge_headers: (Headers | Hash) -> void
|
|
21
|
+
|
|
22
|
+
def scheme: () -> ("http" | "https")
|
|
23
|
+
|
|
24
|
+
def response=: (Response response) -> void
|
|
25
|
+
|
|
26
|
+
def path: () -> String
|
|
27
|
+
|
|
28
|
+
def authority: () -> String
|
|
29
|
+
|
|
30
|
+
def origin: () -> String
|
|
31
|
+
|
|
32
|
+
def query: () -> String
|
|
33
|
+
|
|
34
|
+
def drain_body: () -> String?
|
|
35
|
+
|
|
36
|
+
def inspect: () -> String
|
|
37
|
+
|
|
38
|
+
def transition: (Symbol) -> void
|
|
39
|
+
|
|
40
|
+
def expects?: () -> boolish
|
|
41
|
+
|
|
42
|
+
class Body
|
|
43
|
+
def initialize: (Headers, Options) -> untyped
|
|
44
|
+
def each: () { (String) -> void } -> void
|
|
45
|
+
| () -> Enumerable[String]
|
|
46
|
+
|
|
47
|
+
def empty?: () -> bool
|
|
48
|
+
def bytesize: () -> Numeric
|
|
49
|
+
def stream: (Transcoder::_Encoder) -> bodyIO
|
|
50
|
+
def unbounded_body?: () -> bool
|
|
51
|
+
def chunked?: () -> bool
|
|
52
|
+
def chunk!: () -> void
|
|
53
|
+
def inspect: () -> String
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
class ProcIO
|
|
57
|
+
include _Writer
|
|
58
|
+
def initialize: (^(_ToS) -> void) -> untyped
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
data/sig/resolver.rbs
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
module HTTPX
|
|
2
|
+
type ipaddr = IPAddr | String
|
|
3
|
+
|
|
4
|
+
type resolver = Resolver::System | Resolver::Native | Resolver::HTTPS
|
|
5
|
+
|
|
6
|
+
module Resolver
|
|
7
|
+
type dns_resource = singleton(Resolv::DNS::Resource)
|
|
8
|
+
|
|
9
|
+
type dns_result = { "name" => String, "TTL" => Numeric, "alias" => String }
|
|
10
|
+
| { "name" => String, "TTL" => Numeric, "data" => String }
|
|
11
|
+
|
|
12
|
+
def self?.cached_lookup: (String hostname) -> Array[String]?
|
|
13
|
+
|
|
14
|
+
def self?.cached_lookup_set: (String hostname, Array[dns_result] addresses) -> void
|
|
15
|
+
|
|
16
|
+
def self?.uncache: (String hostname) -> void
|
|
17
|
+
|
|
18
|
+
def self?.lookup: (String hostname, Numeric ttl) -> Array[String]?
|
|
19
|
+
|
|
20
|
+
def self?.generate_id: () -> Integer
|
|
21
|
+
|
|
22
|
+
def self?.encode_dns_query: (String hostname, ?type: dns_resource) -> String
|
|
23
|
+
|
|
24
|
+
def self?.decode_dns_answer: (String) -> Array[dns_result]
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
module HTTPX
|
|
2
|
+
module Resolver
|
|
3
|
+
class HTTPS
|
|
4
|
+
include ResolverMixin
|
|
5
|
+
include _ToIO
|
|
6
|
+
|
|
7
|
+
@options: Options
|
|
8
|
+
@resolver_options: Hash[Symbol, untyped]
|
|
9
|
+
@_record_types: Hash[String, Hash["A" | "AAAA", dns_resource]]
|
|
10
|
+
@queries: Hash[String, Connection]
|
|
11
|
+
@requests: Hash[Request, Connection]
|
|
12
|
+
@connections: Array[Connection]
|
|
13
|
+
@uri: URI::HTTPS
|
|
14
|
+
@uri_addresses: Array[String]?
|
|
15
|
+
|
|
16
|
+
def <<: (Connection) -> void
|
|
17
|
+
|
|
18
|
+
def timeout: () -> Numeric?
|
|
19
|
+
|
|
20
|
+
def closed?: () -> bool
|
|
21
|
+
|
|
22
|
+
def empty?: () -> bool
|
|
23
|
+
|
|
24
|
+
def close: () -> void
|
|
25
|
+
|
|
26
|
+
def call: () -> void
|
|
27
|
+
|
|
28
|
+
def interests: () -> io_interests?
|
|
29
|
+
|
|
30
|
+
private
|
|
31
|
+
|
|
32
|
+
def initialize: (options) -> untyped
|
|
33
|
+
|
|
34
|
+
def pool: () -> Pool
|
|
35
|
+
|
|
36
|
+
def resolver_connection: () -> Connection
|
|
37
|
+
|
|
38
|
+
def resolve: (Connection, String hostname) -> void
|
|
39
|
+
| (Connection) -> void
|
|
40
|
+
| () -> void
|
|
41
|
+
|
|
42
|
+
def on_response: (Request, response) -> void
|
|
43
|
+
|
|
44
|
+
def response: (Response) -> void
|
|
45
|
+
|
|
46
|
+
def build_request: (String hostname, "A" | "AAAA") -> Request
|
|
47
|
+
|
|
48
|
+
def decode_response_body: (Response) -> Array[dns_result]
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|