httpx 1.3.4 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/doc/release_notes/1_4_0.md +43 -0
- data/lib/httpx/adapters/faraday.rb +2 -0
- data/lib/httpx/adapters/webmock.rb +11 -5
- data/lib/httpx/callbacks.rb +0 -5
- data/lib/httpx/chainable.rb +3 -1
- data/lib/httpx/connection/http2.rb +11 -7
- data/lib/httpx/connection.rb +128 -16
- data/lib/httpx/errors.rb +12 -0
- data/lib/httpx/loggable.rb +5 -5
- data/lib/httpx/options.rb +26 -16
- data/lib/httpx/plugins/aws_sigv4.rb +31 -16
- data/lib/httpx/plugins/callbacks.rb +12 -2
- data/lib/httpx/plugins/circuit_breaker.rb +0 -5
- data/lib/httpx/plugins/content_digest.rb +202 -0
- data/lib/httpx/plugins/expect.rb +4 -3
- data/lib/httpx/plugins/follow_redirects.rb +7 -8
- data/lib/httpx/plugins/h2c.rb +23 -20
- data/lib/httpx/plugins/internal_telemetry.rb +27 -0
- data/lib/httpx/plugins/persistent.rb +16 -0
- data/lib/httpx/plugins/proxy/http.rb +17 -19
- data/lib/httpx/plugins/proxy.rb +91 -93
- data/lib/httpx/plugins/retries.rb +5 -8
- data/lib/httpx/plugins/upgrade.rb +5 -10
- data/lib/httpx/plugins/webdav.rb +6 -0
- data/lib/httpx/plugins/xml.rb +76 -0
- data/lib/httpx/pool.rb +73 -244
- data/lib/httpx/request/body.rb +16 -12
- data/lib/httpx/request.rb +1 -1
- data/lib/httpx/resolver/https.rb +12 -19
- data/lib/httpx/resolver/multi.rb +34 -16
- data/lib/httpx/resolver/native.rb +36 -13
- data/lib/httpx/resolver/resolver.rb +49 -11
- data/lib/httpx/resolver/system.rb +29 -11
- data/lib/httpx/resolver.rb +21 -14
- data/lib/httpx/response.rb +5 -3
- data/lib/httpx/selector.rb +164 -95
- data/lib/httpx/session.rb +296 -139
- data/lib/httpx/transcoder/gzip.rb +0 -3
- data/lib/httpx/transcoder/json.rb +14 -2
- data/lib/httpx/transcoder/utils/deflater.rb +7 -4
- data/lib/httpx/transcoder/utils/inflater.rb +2 -0
- data/lib/httpx/transcoder.rb +0 -1
- data/lib/httpx/version.rb +1 -1
- data/lib/httpx.rb +19 -20
- data/sig/callbacks.rbs +0 -1
- data/sig/chainable.rbs +4 -0
- data/sig/connection/http2.rbs +1 -1
- data/sig/connection.rbs +14 -3
- data/sig/errors.rbs +6 -0
- data/sig/loggable.rbs +2 -0
- data/sig/options.rbs +7 -0
- data/sig/plugins/aws_sigv4.rbs +8 -2
- data/sig/plugins/content_digest.rbs +51 -0
- data/sig/plugins/cookies/cookie.rbs +9 -0
- data/sig/plugins/grpc/call.rbs +4 -0
- data/sig/plugins/persistent.rbs +4 -1
- data/sig/plugins/proxy/socks5.rbs +11 -3
- data/sig/plugins/proxy.rbs +18 -11
- data/sig/plugins/push_promise.rbs +3 -0
- data/sig/plugins/rate_limiter.rbs +2 -0
- data/sig/plugins/retries.rbs +1 -1
- data/sig/plugins/ssrf_filter.rbs +26 -0
- data/sig/plugins/webdav.rbs +23 -0
- data/sig/plugins/xml.rbs +37 -0
- data/sig/pool.rbs +25 -33
- data/sig/request/body.rbs +5 -1
- data/sig/resolver/multi.rbs +26 -1
- data/sig/resolver/native.rbs +0 -2
- data/sig/resolver/resolver.rbs +21 -2
- data/sig/resolver.rbs +5 -1
- data/sig/response/buffer.rbs +1 -1
- data/sig/selector.rbs +30 -4
- data/sig/session.rbs +45 -18
- data/sig/transcoder/body.rbs +1 -1
- data/sig/transcoder/chunker.rbs +1 -1
- data/sig/transcoder/deflate.rbs +1 -0
- data/sig/transcoder/form.rbs +8 -0
- data/sig/transcoder/gzip.rbs +4 -1
- data/sig/transcoder/utils/body_reader.rbs +2 -2
- data/sig/transcoder/utils/deflater.rbs +2 -2
- metadata +10 -4
- data/lib/httpx/transcoder/xml.rb +0 -52
- data/sig/transcoder/xml.rbs +0 -22
data/lib/httpx.rb
CHANGED
@@ -2,28 +2,11 @@
|
|
2
2
|
|
3
3
|
require "httpx/version"
|
4
4
|
|
5
|
-
require "httpx/extensions"
|
6
|
-
|
7
|
-
require "httpx/errors"
|
8
|
-
require "httpx/utils"
|
9
|
-
require "httpx/punycode"
|
10
|
-
require "httpx/domain_name"
|
11
|
-
require "httpx/altsvc"
|
12
|
-
require "httpx/callbacks"
|
13
|
-
require "httpx/loggable"
|
14
|
-
require "httpx/transcoder"
|
15
|
-
require "httpx/timers"
|
16
|
-
require "httpx/pool"
|
17
|
-
require "httpx/headers"
|
18
|
-
require "httpx/request"
|
19
|
-
require "httpx/response"
|
20
|
-
require "httpx/options"
|
21
|
-
require "httpx/chainable"
|
22
|
-
|
23
5
|
# Top-Level Namespace
|
24
6
|
#
|
25
7
|
module HTTPX
|
26
8
|
EMPTY = [].freeze
|
9
|
+
EMPTY_HASH = {}.freeze
|
27
10
|
|
28
11
|
# All plugins should be stored under this module/namespace. Can register and load
|
29
12
|
# plugins.
|
@@ -53,10 +36,26 @@ module HTTPX
|
|
53
36
|
m.synchronize { h[name] = mod }
|
54
37
|
end
|
55
38
|
end
|
56
|
-
|
57
|
-
extend Chainable
|
58
39
|
end
|
59
40
|
|
41
|
+
require "httpx/extensions"
|
42
|
+
|
43
|
+
require "httpx/errors"
|
44
|
+
require "httpx/utils"
|
45
|
+
require "httpx/punycode"
|
46
|
+
require "httpx/domain_name"
|
47
|
+
require "httpx/altsvc"
|
48
|
+
require "httpx/callbacks"
|
49
|
+
require "httpx/loggable"
|
50
|
+
require "httpx/transcoder"
|
51
|
+
require "httpx/timers"
|
52
|
+
require "httpx/pool"
|
53
|
+
require "httpx/headers"
|
54
|
+
require "httpx/request"
|
55
|
+
require "httpx/response"
|
56
|
+
require "httpx/options"
|
57
|
+
require "httpx/chainable"
|
58
|
+
|
60
59
|
require "httpx/session"
|
61
60
|
require "httpx/session_extensions"
|
62
61
|
|
data/sig/callbacks.rbs
CHANGED
@@ -6,7 +6,6 @@ module HTTPX
|
|
6
6
|
module Callbacks
|
7
7
|
def on: (Symbol) { (*untyped) -> void } -> self
|
8
8
|
def once: (Symbol) { (*untyped) -> void } -> self
|
9
|
-
def only: (Symbol) { (*untyped) -> void } -> self
|
10
9
|
def emit: (Symbol, *untyped) -> void
|
11
10
|
|
12
11
|
def callbacks_for?: (Symbol) -> bool
|
data/sig/chainable.rbs
CHANGED
@@ -35,6 +35,10 @@ module HTTPX
|
|
35
35
|
| (:circuit_breaker, ?options) -> Plugins::sessionCircuitBreaker
|
36
36
|
| (:oauth, ?options) -> Plugins::sessionOAuth
|
37
37
|
| (:callbacks, ?options) -> Plugins::sessionCallbacks
|
38
|
+
| (:content_digest, ?options) -> Plugins::sessionContentDigest
|
39
|
+
| (:ssrf_filter, ?options) -> Plugins::sessionSsrf
|
40
|
+
| (:webdav, ?options) -> Plugins::sessionWebDav
|
41
|
+
| (:xml, ?options) -> Plugins::sessionXML
|
38
42
|
| (Symbol | Module, ?options) { (Class) -> void } -> Session
|
39
43
|
| (Symbol | Module, ?options) -> Session
|
40
44
|
|
data/sig/connection/http2.rbs
CHANGED
data/sig/connection.rbs
CHANGED
@@ -26,8 +26,9 @@ module HTTPX
|
|
26
26
|
attr_reader pending: Array[Request]
|
27
27
|
attr_reader options: Options
|
28
28
|
attr_reader ssl_session: OpenSSL::SSL::Session?
|
29
|
-
attr_writer
|
30
|
-
|
29
|
+
attr_writer current_selector: Selector?
|
30
|
+
attr_writer coalesced_connection: instance?
|
31
|
+
attr_accessor current_session: Session?
|
31
32
|
attr_accessor family: Integer?
|
32
33
|
|
33
34
|
@window_size: Integer
|
@@ -42,9 +43,13 @@ module HTTPX
|
|
42
43
|
@connected_at: Float
|
43
44
|
@response_received_at: Float
|
44
45
|
@intervals: Array[Timers::Interval]
|
46
|
+
@exhausted: bool
|
47
|
+
@cloned: bool
|
45
48
|
|
46
49
|
def addresses: () -> Array[ipaddr]?
|
47
50
|
|
51
|
+
def peer: () -> URI::Generic
|
52
|
+
|
48
53
|
def addresses=: (Array[ipaddr] addresses) -> void
|
49
54
|
|
50
55
|
def send: (Request request) -> void
|
@@ -57,7 +62,7 @@ module HTTPX
|
|
57
62
|
|
58
63
|
def coalescable?: (Connection connection) -> bool
|
59
64
|
|
60
|
-
def create_idle: (?Hash[Symbol, untyped] options) ->
|
65
|
+
def create_idle: (?Hash[Symbol, untyped] options) -> instance
|
61
66
|
|
62
67
|
def merge: (Connection connection) -> void
|
63
68
|
|
@@ -77,6 +82,8 @@ module HTTPX
|
|
77
82
|
|
78
83
|
def close: () -> void
|
79
84
|
|
85
|
+
def force_reset: (?bool cloned) -> void
|
86
|
+
|
80
87
|
def reset: () -> void
|
81
88
|
|
82
89
|
def timeout: () -> Numeric?
|
@@ -99,6 +106,8 @@ module HTTPX
|
|
99
106
|
|
100
107
|
def connect: () -> void
|
101
108
|
|
109
|
+
def disconnect: () -> void
|
110
|
+
|
102
111
|
def exhausted?: () -> boolish
|
103
112
|
|
104
113
|
def consume: () -> void
|
@@ -117,6 +126,8 @@ module HTTPX
|
|
117
126
|
|
118
127
|
def handle_transition: (Symbol nextstate) -> void
|
119
128
|
|
129
|
+
def build_altsvc_connection: (URI::Generic alt_origin, String origin, Hash[String, String] alt_params) -> void
|
130
|
+
|
120
131
|
def build_socket: (?Array[ipaddr]? addrs) -> (TCP | SSL | UNIX)
|
121
132
|
|
122
133
|
def on_error: (HTTPX::TimeoutError | Error | StandardError error, ?Request? request) -> void
|
data/sig/errors.rbs
CHANGED
@@ -17,6 +17,12 @@ module HTTPX
|
|
17
17
|
def initialize: (Numeric timeout, String message) -> untyped
|
18
18
|
end
|
19
19
|
|
20
|
+
class PoolTimeoutError < TimeoutError
|
21
|
+
attr_reader origin: String
|
22
|
+
|
23
|
+
def initialize: (String origin, Numeric timeout) -> void
|
24
|
+
end
|
25
|
+
|
20
26
|
class ConnectTimeoutError < TimeoutError
|
21
27
|
end
|
22
28
|
|
data/sig/loggable.rbs
CHANGED
data/sig/options.rbs
CHANGED
@@ -77,6 +77,8 @@ module HTTPX
|
|
77
77
|
# classes
|
78
78
|
attr_reader connection_class: singleton(Connection)
|
79
79
|
|
80
|
+
attr_reader pool_class: singleton(Pool)
|
81
|
+
|
80
82
|
attr_reader request_class: singleton(Request)
|
81
83
|
|
82
84
|
attr_reader response_class: singleton(Response)
|
@@ -110,6 +112,9 @@ module HTTPX
|
|
110
112
|
# resolver_options
|
111
113
|
attr_reader resolver_options: Hash[Symbol, untyped]
|
112
114
|
|
115
|
+
# resolver_options
|
116
|
+
attr_reader pool_options: pool_options
|
117
|
+
|
113
118
|
# ip_families
|
114
119
|
attr_reader ip_families: Array[ip_family]
|
115
120
|
|
@@ -130,6 +135,8 @@ module HTTPX
|
|
130
135
|
def initialize: (?options options) -> void
|
131
136
|
|
132
137
|
def do_initialize: (?options options) -> void
|
138
|
+
|
139
|
+
def access_option: (Hash[Symbol, untyped] | Object | nil obj, Symbol k, Hash[Symbol, Symbol]? ivar_map) -> untyped
|
133
140
|
end
|
134
141
|
|
135
142
|
type options = Options | Hash[Symbol, untyped]
|
data/sig/plugins/aws_sigv4.rbs
CHANGED
@@ -17,8 +17,14 @@ module HTTPX
|
|
17
17
|
|
18
18
|
|
19
19
|
class Signer
|
20
|
-
|
20
|
+
@credentials: Object & _SigV4Credentials
|
21
|
+
@service: String
|
22
|
+
@region: String
|
21
23
|
@unsigned_headers: Set[String]
|
24
|
+
@apply_checksum_header: bool
|
25
|
+
@provider_prefix: String
|
26
|
+
@header_provider_field: String
|
27
|
+
@algorithm: String
|
22
28
|
|
23
29
|
def sign!: (Request & RequestMethods request) -> void
|
24
30
|
|
@@ -41,7 +47,7 @@ module HTTPX
|
|
41
47
|
) -> untyped
|
42
48
|
|
43
49
|
|
44
|
-
def hexdigest: (
|
50
|
+
def hexdigest: (Request::Body value) -> String
|
45
51
|
|
46
52
|
def hmac: (String key, String value) -> String
|
47
53
|
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module HTTPX
|
2
|
+
module Plugins
|
3
|
+
module ContentDigest
|
4
|
+
class Error < HTTPX::Error
|
5
|
+
end
|
6
|
+
class ValidationError < Error
|
7
|
+
attr_reader response: Response
|
8
|
+
|
9
|
+
def initialize: (String message, Response response) -> void
|
10
|
+
end
|
11
|
+
class MissingContentDigestError < ValidationError
|
12
|
+
end
|
13
|
+
class InvalidContentDigestError < ValidationError
|
14
|
+
end
|
15
|
+
|
16
|
+
SUPPORTED_ALGORITHMS: Hash[String, singleton(OpenSSL::Digest)]
|
17
|
+
|
18
|
+
interface _ContentDigestOptions
|
19
|
+
def digest_algorithm: () -> String
|
20
|
+
def encode_content_digest: () -> (bool | ^(Request) -> boolish)
|
21
|
+
def validate_content_digest: () -> (bool | ^(contentDigestResponse) -> boolish)
|
22
|
+
end
|
23
|
+
|
24
|
+
# def self.extra_options: (Options) -> contentDigestOptions
|
25
|
+
|
26
|
+
module InstanceMethods
|
27
|
+
private
|
28
|
+
|
29
|
+
def validate_content_digest: (Response response) -> void
|
30
|
+
|
31
|
+
def extract_content_digests: (String) -> Hash[String, String]
|
32
|
+
|
33
|
+
def base64digest: (Request::Body | contentDigestResponseBody body) -> String
|
34
|
+
end
|
35
|
+
|
36
|
+
module ResponseMethods
|
37
|
+
attr_reader body: contentDigestResponseBody
|
38
|
+
end
|
39
|
+
|
40
|
+
module ResponseBodyMethods
|
41
|
+
attr_reader content_digest_buffer: Response::Buffer?
|
42
|
+
end
|
43
|
+
|
44
|
+
type contentDigestOptions = Options & _ContentDigestOptions
|
45
|
+
type contentDigestResponse = Response & ResponseMethods
|
46
|
+
type contentDigestResponseBody = Response::Body & ResponseBodyMethods
|
47
|
+
end
|
48
|
+
|
49
|
+
type sessionContentDigest = Session & ContentDigest::InstanceMethods
|
50
|
+
end
|
51
|
+
end
|
@@ -17,6 +17,10 @@ module HTTPX
|
|
17
17
|
|
18
18
|
attr_reader created_at: Time
|
19
19
|
|
20
|
+
@for_domain: bool
|
21
|
+
|
22
|
+
@domain_name: DomainName
|
23
|
+
|
20
24
|
def path=: (string) -> void
|
21
25
|
|
22
26
|
def domain=: (string) -> void
|
@@ -43,6 +47,11 @@ module HTTPX
|
|
43
47
|
| (_ToS, _ToS, ?cookie_attributes) -> untyped
|
44
48
|
|
45
49
|
def acceptable_from_uri?: (uri) -> bool
|
50
|
+
|
51
|
+
module Scanner
|
52
|
+
RE_BAD_CHAR: Regexp
|
53
|
+
def self?.quote: (String s) -> String
|
54
|
+
end
|
46
55
|
end
|
47
56
|
end
|
48
57
|
end
|
data/sig/plugins/grpc/call.rbs
CHANGED
data/sig/plugins/persistent.rbs
CHANGED
@@ -4,8 +4,11 @@ module HTTPX
|
|
4
4
|
def self.load_dependencies: (singleton(Session)) -> void
|
5
5
|
|
6
6
|
def self.extra_options: (Options) -> (Options)
|
7
|
+
|
8
|
+
module InstanceMethods
|
9
|
+
end
|
7
10
|
end
|
8
11
|
|
9
|
-
type sessionPersistent =
|
12
|
+
type sessionPersistent = Session & Persistent::InstanceMethods
|
10
13
|
end
|
11
14
|
end
|
@@ -6,6 +6,14 @@ module HTTPX
|
|
6
6
|
module Proxy
|
7
7
|
module Socks5
|
8
8
|
VERSION: Integer
|
9
|
+
NOAUTH: Integer
|
10
|
+
PASSWD: Integer
|
11
|
+
NONE: Integer
|
12
|
+
CONNECT: Integer
|
13
|
+
IPV4: Integer
|
14
|
+
DOMAIN: Integer
|
15
|
+
IPV6: Integer
|
16
|
+
SUCCESS: Integer
|
9
17
|
|
10
18
|
module ConnectionMethods
|
11
19
|
def __socks5_proxy_connect: () -> void
|
@@ -31,9 +39,9 @@ module HTTPX
|
|
31
39
|
end
|
32
40
|
|
33
41
|
module Packet
|
34
|
-
def self?.negotiate: (Parameters) -> String
|
35
|
-
def self?.authenticate: (Parameters) -> String
|
36
|
-
def self?.connect: (uri) -> String
|
42
|
+
def self?.negotiate: (Parameters parameters) -> String
|
43
|
+
def self?.authenticate: (Parameters parameters) -> String
|
44
|
+
def self?.connect: (uri uri) -> String
|
37
45
|
end
|
38
46
|
end
|
39
47
|
end
|
data/sig/plugins/proxy.rbs
CHANGED
@@ -6,15 +6,25 @@ module HTTPX
|
|
6
6
|
end
|
7
7
|
|
8
8
|
module Plugins
|
9
|
+
interface _Authenticator
|
10
|
+
def authenticate: (Request request, String authenticate) -> String
|
11
|
+
end
|
12
|
+
|
9
13
|
module Proxy
|
10
14
|
Error: singleton(HTTPProxyError)
|
11
15
|
PROXY_ERRORS: Array[singleton(StandardError)]
|
12
16
|
|
13
17
|
class Parameters
|
14
|
-
attr_reader uri: URI::Generic
|
18
|
+
attr_reader uri: URI::Generic?
|
15
19
|
attr_reader username: String?
|
16
20
|
attr_reader password: String?
|
17
21
|
attr_reader scheme: String?
|
22
|
+
attr_reader no_proxy: Array[String]?
|
23
|
+
|
24
|
+
@uris: Array[URI::Generic | String]
|
25
|
+
@authenticator: _Authenticator
|
26
|
+
|
27
|
+
def shift: () -> void
|
18
28
|
|
19
29
|
def can_authenticate?: (*untyped) -> boolish
|
20
30
|
|
@@ -24,15 +34,17 @@ module HTTPX
|
|
24
34
|
|
25
35
|
private
|
26
36
|
|
27
|
-
def initialize: (uri: generic_uri, ?scheme: String, ?username: String, ?password: String, **untyped) ->
|
37
|
+
def initialize: (?uri: generic_uri | Array[generic_uri], ?scheme: String, ?username: String, ?password: String, ?no_proxy: Array[generic_uri] | generic_uri, **untyped) -> void
|
38
|
+
|
39
|
+
def infer_default_auth_scheme: (URI::Generic uri) -> String?
|
40
|
+
|
41
|
+
def load_authenticator: (String scheme, String username, String password, **untyped) -> _Authenticator
|
28
42
|
end
|
29
43
|
|
30
44
|
def self.configure: (singleton(Session)) -> void
|
31
45
|
|
32
|
-
type proxyParam = Parameters | Hash[Symbol, untyped]
|
33
|
-
|
34
46
|
interface _ProxyOptions
|
35
|
-
def proxy: () ->
|
47
|
+
def proxy: () -> Parameters?
|
36
48
|
end
|
37
49
|
|
38
50
|
def self.extra_options: (Options) -> (Options & _ProxyOptions)
|
@@ -42,12 +54,7 @@ module HTTPX
|
|
42
54
|
|
43
55
|
private
|
44
56
|
|
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
|
57
|
+
def proxy_error?: (Request request, response, Options options) -> bool
|
51
58
|
end
|
52
59
|
end
|
53
60
|
|
@@ -2,11 +2,14 @@ module HTTPX
|
|
2
2
|
module Plugins
|
3
3
|
module PushPromise
|
4
4
|
module ResponseMethods
|
5
|
+
@__pushed: bool?
|
6
|
+
|
5
7
|
def pushed?: () -> boolish
|
6
8
|
def mark_as_pushed!: () -> void
|
7
9
|
end
|
8
10
|
|
9
11
|
module InstanceMethods
|
12
|
+
@promise_headers: Hash[::HTTP2::Stream, Request]?
|
10
13
|
private
|
11
14
|
|
12
15
|
def promise_headers: () -> Hash[::HTTP2::Stream, Request]
|
data/sig/plugins/retries.rbs
CHANGED
@@ -29,7 +29,7 @@ module HTTPX
|
|
29
29
|
|
30
30
|
private
|
31
31
|
|
32
|
-
def fetch_response: (retriesRequest request,
|
32
|
+
def fetch_response: (retriesRequest request, Selector selector, retriesOptions options) -> (retriesResponse | ErrorResponse)?
|
33
33
|
|
34
34
|
def __repeatable_request?: (retriesRequest request, retriesOptions options) -> boolish
|
35
35
|
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module HTTPX
|
2
|
+
class ServerSideRequestForgeryError < Error
|
3
|
+
end
|
4
|
+
|
5
|
+
module Plugins
|
6
|
+
module SsrfFilter
|
7
|
+
IPV4_BLACKLIST: Array[IPAddr]
|
8
|
+
|
9
|
+
IPV6_BLACKLIST: Array[[IPAddr, IPAddr]]
|
10
|
+
|
11
|
+
def self?.unsafe_ip_address?: (IPAddr) -> bool
|
12
|
+
|
13
|
+
interface _Options
|
14
|
+
def allowed_schemes: () -> Array[String]
|
15
|
+
end
|
16
|
+
|
17
|
+
module InstanceMethods
|
18
|
+
end
|
19
|
+
|
20
|
+
module ConnectionMethods
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
type sessionSsrf = Session & SsrfFilter::InstanceMethods
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module HTTPX
|
2
|
+
module Plugins
|
3
|
+
module WebDav
|
4
|
+
module InstanceMethods
|
5
|
+
def copy: (String src, String dst) -> (Response | ErrorResponse)
|
6
|
+
|
7
|
+
def move: (String src, String dst) -> (Response | ErrorResponse)
|
8
|
+
|
9
|
+
def lock: (String path, ?timeout: Numeric) ?{ (Response response) -> void } -> (Response | ErrorResponse)
|
10
|
+
|
11
|
+
def unlock: (String path, String? lock_token) -> (Response | ErrorResponse)
|
12
|
+
|
13
|
+
def mkcol: (String dir) -> Response
|
14
|
+
|
15
|
+
def propfind: (String path, ?(:acl | String) xml) -> Response
|
16
|
+
|
17
|
+
def proppatch: (String path, String xml) -> Response
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
type sessionWebDav = Session & WebDav::InstanceMethods
|
22
|
+
end
|
23
|
+
end
|
data/sig/plugins/xml.rbs
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
module HTTPX
|
2
|
+
module Plugins
|
3
|
+
module XML
|
4
|
+
MIME_TYPES: Regexp
|
5
|
+
|
6
|
+
module Transcoder
|
7
|
+
def self?.encode: (Nokogiri::XML::Node | String xml) -> Encoder
|
8
|
+
def self?.decode: (HTTPX::Response response) -> HTTPX::Transcoder::_Decoder
|
9
|
+
|
10
|
+
class Encoder
|
11
|
+
@raw: Nokogiri::XML::Node | String # can be nokogiri object
|
12
|
+
|
13
|
+
def content_type: () -> String
|
14
|
+
|
15
|
+
def bytesize: () -> (Integer | Float)
|
16
|
+
|
17
|
+
def to_s: () -> String
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def initialize: (Nokogiri::XML::Node | String xml) -> void
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
module InstanceMethods
|
26
|
+
end
|
27
|
+
|
28
|
+
module ResponseMethods
|
29
|
+
def xml: () -> Nokogiri::XML::Node
|
30
|
+
end
|
31
|
+
|
32
|
+
module RequestBodyClassMethods
|
33
|
+
end
|
34
|
+
end
|
35
|
+
type sessionXML = Session & XML::InstanceMethods
|
36
|
+
end
|
37
|
+
end
|
data/sig/pool.rbs
CHANGED
@@ -1,52 +1,44 @@
|
|
1
1
|
module HTTPX
|
2
|
+
type pool_options = {
|
3
|
+
max_connections_per_origin: Integer?,
|
4
|
+
pool_timeout: Numeric?
|
5
|
+
}
|
6
|
+
|
2
7
|
class Pool
|
3
8
|
type resolver_manager = Resolver::Multi | Resolver::System
|
4
9
|
|
5
|
-
@
|
6
|
-
@
|
7
|
-
@
|
8
|
-
@
|
10
|
+
@max_connections_per_origin: Integer
|
11
|
+
@pool_timeout: Numeric
|
12
|
+
@options: Options
|
13
|
+
@resolvers: Hash[Class, Array[resolver_manager]]
|
14
|
+
@resolver_mtx: Thread::Mutex
|
15
|
+
@connections: Hash[String, Array[Connection]]
|
16
|
+
@connection_mtx: Thread::Mutex
|
17
|
+
@origin_counters: Hash[String, Integer]
|
18
|
+
@origin_conds: Hash[String, ConditionVariable]
|
9
19
|
|
10
|
-
def
|
20
|
+
def pop_connection: () -> Connection?
|
11
21
|
|
12
|
-
def
|
22
|
+
def checkout_connection: (http_uri uri, Options options) -> Connection
|
13
23
|
|
14
|
-
def
|
24
|
+
def checkin_connection: (Connection connection) -> void
|
15
25
|
|
16
|
-
def
|
26
|
+
def checkout_mergeable_connection: (Connection connection) -> Connection?
|
17
27
|
|
18
|
-
def
|
28
|
+
def reset_resolvers: () -> void
|
19
29
|
|
20
|
-
def
|
30
|
+
def checkout_resolver: (Options options) -> resolver_manager
|
21
31
|
|
22
|
-
def
|
32
|
+
def checkin_resolver: (Resolver::Resolver resolver) -> void
|
23
33
|
|
24
34
|
private
|
25
35
|
|
26
|
-
def initialize: () -> void
|
27
|
-
|
28
|
-
def try_clone_connection: (Connection connection, Integer? family) -> Connection
|
29
|
-
|
30
|
-
def resolve_connection: (Connection) -> void
|
31
|
-
|
32
|
-
def on_resolver_connection: (Connection) -> void
|
33
|
-
|
34
|
-
def on_resolver_error: (Connection, StandardError) -> void
|
35
|
-
|
36
|
-
def on_resolver_close: (Resolver::Resolver) -> void
|
37
|
-
|
38
|
-
def register_connection: (Connection) -> void
|
39
|
-
|
40
|
-
def unregister_connection: (Connection, ?bool cleanup) -> void
|
41
|
-
|
42
|
-
def select_connection: (Selector::selectable) -> void
|
43
|
-
|
44
|
-
def deselect_connection: (Selector::selectable) -> Selector::selectable?
|
36
|
+
def initialize: (pool_options options) -> void
|
45
37
|
|
46
|
-
def
|
38
|
+
def acquire_connection: (http_uri uri, Options options) -> Connection?
|
47
39
|
|
48
|
-
def
|
40
|
+
def checkout_new_connection: (http_uri uri, Options options) -> Connection
|
49
41
|
|
50
|
-
def
|
42
|
+
def checkout_new_resolver: (Class resolver_type, Options options) -> resolver_manager
|
51
43
|
end
|
52
44
|
end
|
data/sig/request/body.rbs
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
module HTTPX
|
2
2
|
class Request::Body
|
3
|
+
attr_reader options: Options
|
4
|
+
|
3
5
|
@headers: Headers
|
4
6
|
@body: body_encoder?
|
5
7
|
@unbounded_body: bool
|
6
8
|
|
7
|
-
def initialize: (Headers
|
9
|
+
def initialize: (Headers h, Options options, **untyped) -> void
|
8
10
|
|
9
11
|
def each: () { (String) -> void } -> void
|
10
12
|
| () -> Enumerable[String]
|
@@ -25,6 +27,8 @@ module HTTPX
|
|
25
27
|
|
26
28
|
private
|
27
29
|
|
30
|
+
def self.initialize_body: (Hash[Symbol, untyped] params) -> body_encoder?
|
31
|
+
|
28
32
|
def self.initialize_deflater_body: (body_encoder body, Encoding | String encoding) -> body_encoder
|
29
33
|
end
|
30
34
|
|
data/sig/resolver/multi.rbs
CHANGED
@@ -1,7 +1,32 @@
|
|
1
1
|
module HTTPX
|
2
2
|
module Resolver
|
3
3
|
class Multi
|
4
|
-
|
4
|
+
attr_reader resolvers: Array[Native | HTTPS]
|
5
|
+
|
6
|
+
attr_reader options: Options
|
7
|
+
|
8
|
+
@current_selector: Selector?
|
9
|
+
@current_session: Session?
|
10
|
+
@resolver_options: Hash[Symbol, untyped]
|
11
|
+
# @errors: Hash[Symbol, untyped]
|
12
|
+
|
13
|
+
def current_selector=: (Selector s) -> void
|
14
|
+
|
15
|
+
def current_session=: (Session s) -> void
|
16
|
+
|
17
|
+
def closed?: () -> bool
|
18
|
+
|
19
|
+
def empty?: () -> bool
|
20
|
+
|
21
|
+
def timeout: () -> Numeric?
|
22
|
+
|
23
|
+
def close: () -> void
|
24
|
+
|
25
|
+
def connections: () -> Array[Connection]
|
26
|
+
|
27
|
+
def early_resolve: (Connection connection) -> bool
|
28
|
+
|
29
|
+
def lazy_resolve: (Connection connection) -> void
|
5
30
|
end
|
6
31
|
end
|
7
32
|
end
|