httpx 0.15.4 → 0.18.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_16_0.md +93 -0
- data/doc/release_notes/0_16_1.md +5 -0
- data/doc/release_notes/0_17_0.md +49 -0
- data/doc/release_notes/0_18_0.md +69 -0
- data/lib/httpx/adapters/datadog.rb +1 -1
- data/lib/httpx/adapters/faraday.rb +8 -14
- data/lib/httpx/adapters/webmock.rb +9 -3
- data/lib/httpx/altsvc.rb +2 -2
- data/lib/httpx/buffer.rb +1 -1
- data/lib/httpx/callbacks.rb +1 -1
- data/lib/httpx/chainable.rb +18 -11
- data/lib/httpx/connection/http1.rb +21 -13
- data/lib/httpx/connection/http2.rb +20 -25
- data/lib/httpx/connection.rb +73 -77
- data/lib/httpx/domain_name.rb +1 -1
- data/lib/httpx/errors.rb +11 -11
- data/lib/httpx/extensions.rb +50 -4
- data/lib/httpx/headers.rb +1 -1
- data/lib/httpx/io/ssl.rb +3 -3
- data/lib/httpx/io/tls.rb +8 -8
- data/lib/httpx/loggable.rb +5 -5
- data/lib/httpx/options.rb +108 -81
- data/lib/httpx/parser/http1.rb +11 -7
- data/lib/httpx/plugins/aws_sdk_authentication.rb +42 -18
- data/lib/httpx/plugins/aws_sigv4.rb +19 -20
- data/lib/httpx/plugins/compression.rb +17 -14
- data/lib/httpx/plugins/cookies/cookie.rb +4 -2
- data/lib/httpx/plugins/cookies/jar.rb +21 -2
- data/lib/httpx/plugins/cookies.rb +20 -7
- data/lib/httpx/plugins/digest_authentication.rb +19 -15
- data/lib/httpx/plugins/expect.rb +26 -18
- data/lib/httpx/plugins/follow_redirects.rb +9 -9
- data/lib/httpx/plugins/grpc/call.rb +4 -1
- data/lib/httpx/plugins/grpc/message.rb +2 -2
- data/lib/httpx/plugins/grpc.rb +72 -46
- data/lib/httpx/plugins/h2c.rb +7 -3
- data/lib/httpx/plugins/internal_telemetry.rb +8 -8
- data/lib/httpx/plugins/multipart/decoder.rb +187 -0
- data/lib/httpx/plugins/multipart/mime_type_detector.rb +3 -3
- data/lib/httpx/plugins/multipart/part.rb +2 -2
- data/lib/httpx/plugins/multipart.rb +16 -2
- data/lib/httpx/plugins/ntlm_authentication.rb +12 -10
- data/lib/httpx/plugins/proxy/socks4.rb +2 -1
- data/lib/httpx/plugins/proxy/socks5.rb +2 -1
- data/lib/httpx/plugins/proxy/ssh.rb +20 -13
- data/lib/httpx/plugins/proxy.rb +10 -10
- data/lib/httpx/plugins/response_cache/store.rb +55 -0
- data/lib/httpx/plugins/response_cache.rb +88 -0
- data/lib/httpx/plugins/retries.rb +46 -23
- data/lib/httpx/plugins/stream.rb +3 -4
- data/lib/httpx/plugins/upgrade.rb +7 -6
- data/lib/httpx/pool.rb +39 -13
- data/lib/httpx/registry.rb +2 -2
- data/lib/httpx/request.rb +16 -25
- data/lib/httpx/resolver/https.rb +4 -8
- data/lib/httpx/resolver/native.rb +19 -5
- data/lib/httpx/resolver/resolver_mixin.rb +2 -1
- data/lib/httpx/resolver/system.rb +2 -0
- data/lib/httpx/resolver.rb +2 -2
- data/lib/httpx/response.rb +91 -48
- data/lib/httpx/selector.rb +11 -24
- data/lib/httpx/session.rb +41 -23
- data/lib/httpx/session2.rb +23 -0
- data/lib/httpx/timers.rb +84 -0
- data/lib/httpx/transcoder/body.rb +3 -2
- data/lib/httpx/transcoder/chunker.rb +2 -1
- data/lib/httpx/transcoder/form.rb +20 -0
- data/lib/httpx/transcoder/json.rb +12 -0
- data/lib/httpx/transcoder.rb +62 -1
- data/lib/httpx/utils.rb +10 -2
- data/lib/httpx/version.rb +1 -1
- data/lib/httpx.rb +7 -3
- data/sig/buffer.rbs +3 -1
- data/sig/chainable.rbs +31 -29
- data/sig/connection/http1.rbs +11 -5
- data/sig/connection/http2.rbs +16 -5
- data/sig/connection.rbs +31 -13
- data/sig/errors.rbs +35 -1
- data/sig/headers.rbs +20 -19
- data/sig/httpx.rbs +4 -1
- data/sig/loggable.rbs +3 -1
- data/sig/options.rbs +45 -34
- data/sig/parser/http1.rbs +3 -3
- data/sig/plugins/authentication.rbs +1 -1
- data/sig/plugins/aws_sdk_authentication.rbs +25 -3
- data/sig/plugins/aws_sigv4.rbs +13 -5
- data/sig/plugins/basic_authentication.rbs +1 -1
- data/sig/plugins/compression.rbs +4 -6
- data/sig/plugins/cookies/cookie.rbs +5 -7
- data/sig/plugins/cookies/jar.rbs +9 -10
- data/sig/plugins/cookies.rbs +4 -5
- data/sig/plugins/digest_authentication.rbs +2 -3
- data/sig/plugins/expect.rbs +2 -4
- data/sig/plugins/follow_redirects.rbs +3 -5
- data/sig/plugins/grpc.rbs +4 -7
- data/sig/plugins/h2c.rbs +0 -2
- data/sig/plugins/multipart.rbs +64 -10
- data/sig/plugins/ntlm_authentication.rbs +2 -3
- data/sig/plugins/persistent.rbs +3 -8
- data/sig/plugins/proxy/ssh.rbs +4 -4
- data/sig/plugins/proxy.rbs +13 -13
- data/sig/plugins/push_promise.rbs +0 -2
- data/sig/plugins/response_cache.rbs +35 -0
- data/sig/plugins/retries.rbs +7 -8
- data/sig/plugins/stream.rbs +1 -1
- data/sig/plugins/upgrade.rbs +2 -3
- data/sig/pool.rbs +7 -2
- data/sig/registry.rbs +1 -1
- data/sig/request.rbs +11 -8
- data/sig/resolver/native.rbs +10 -5
- data/sig/resolver/resolver_mixin.rbs +4 -5
- data/sig/resolver/system.rbs +4 -0
- data/sig/resolver.rbs +7 -0
- data/sig/response.rbs +26 -13
- data/sig/selector.rbs +11 -9
- data/sig/session.rbs +22 -23
- data/sig/timers.rbs +32 -0
- data/sig/transcoder/body.rbs +6 -1
- data/sig/transcoder/chunker.rbs +8 -2
- data/sig/transcoder/form.rbs +3 -1
- data/sig/transcoder/json.rbs +2 -0
- data/sig/transcoder.rbs +13 -5
- data/sig/utils.rbs +6 -0
- metadata +18 -18
- data/lib/httpx/request2.rb +0 -14
data/sig/connection/http2.rbs
CHANGED
|
@@ -3,10 +3,13 @@ module HTTPX
|
|
|
3
3
|
include Callbacks
|
|
4
4
|
include Loggable
|
|
5
5
|
|
|
6
|
+
MAX_CONCURRENT_REQUESTS: Integer
|
|
7
|
+
|
|
6
8
|
attr_reader streams: Hash[Request, HTTP2Next::Stream]
|
|
7
9
|
attr_reader pending: Array[Request]
|
|
8
10
|
|
|
9
11
|
@options: Options
|
|
12
|
+
@settings: Hash[Symbol, Integer | bool]
|
|
10
13
|
@max_concurrent_requests: Integer
|
|
11
14
|
@max_requests: Integer
|
|
12
15
|
@drains: Hash[Request, String]
|
|
@@ -23,7 +26,7 @@ module HTTPX
|
|
|
23
26
|
|
|
24
27
|
def <<: (String) -> void
|
|
25
28
|
|
|
26
|
-
def can_buffer_more_requests
|
|
29
|
+
def can_buffer_more_requests?: () -> bool
|
|
27
30
|
|
|
28
31
|
def send: (Request) -> void
|
|
29
32
|
|
|
@@ -35,7 +38,7 @@ module HTTPX
|
|
|
35
38
|
|
|
36
39
|
alias reset init_connection
|
|
37
40
|
|
|
38
|
-
def timeout: () ->
|
|
41
|
+
def timeout: () -> Numeric
|
|
39
42
|
|
|
40
43
|
private
|
|
41
44
|
|
|
@@ -45,7 +48,7 @@ module HTTPX
|
|
|
45
48
|
|
|
46
49
|
def headline_uri: (Request) -> String
|
|
47
50
|
|
|
48
|
-
def set_protocol_headers: (Request) -> _Each[
|
|
51
|
+
def set_protocol_headers: (Request) -> _Each[[String, String]]
|
|
49
52
|
|
|
50
53
|
def handle: (Request request, HTTP2Next::Stream stream) -> void
|
|
51
54
|
|
|
@@ -61,9 +64,11 @@ module HTTPX
|
|
|
61
64
|
|
|
62
65
|
def on_stream_headers: (HTTP2Next::Stream stream, Request request, Array[[String, String]] headers) -> void
|
|
63
66
|
|
|
64
|
-
def on_stream_trailers: (HTTP2Next::Stream stream,
|
|
67
|
+
def on_stream_trailers: (HTTP2Next::Stream stream, Response response, Array[[String, String]] headers) -> void
|
|
68
|
+
|
|
69
|
+
def on_stream_data: (HTTP2Next::Stream stream, Request request, String data) -> void
|
|
65
70
|
|
|
66
|
-
def
|
|
71
|
+
def on_stream_refuse: (HTTP2Next::Stream stream, Request request, StandardError error) -> void
|
|
67
72
|
|
|
68
73
|
def on_stream_close: (HTTP2Next::Stream stream, Request request, (Symbol | StandardError)? error) -> void
|
|
69
74
|
|
|
@@ -74,12 +79,18 @@ module HTTPX
|
|
|
74
79
|
def on_close: (Integer last_frame, Symbol? error, String? payload) -> void
|
|
75
80
|
|
|
76
81
|
def on_frame_sent: (HTTP2Next::frame) -> void
|
|
82
|
+
|
|
77
83
|
def on_frame_received: (HTTP2Next::frame) -> void
|
|
78
84
|
|
|
85
|
+
def on_altsvc: (String origin, HTTP2Next::frame) -> void
|
|
86
|
+
|
|
79
87
|
def on_promise: (HTTP2Next::Stream) -> void
|
|
80
88
|
|
|
81
89
|
def on_origin: (String) -> void
|
|
82
90
|
|
|
83
91
|
def on_pong: (string ping) -> void
|
|
92
|
+
|
|
93
|
+
class Error < ::HTTPX::Error
|
|
94
|
+
end
|
|
84
95
|
end
|
|
85
96
|
end
|
data/sig/connection.rbs
CHANGED
|
@@ -4,45 +4,62 @@ module HTTPX
|
|
|
4
4
|
|
|
5
5
|
def on: (Symbol) { (*untyped) -> void } -> void
|
|
6
6
|
def empty?: () -> bool
|
|
7
|
+
# def exhausted?: () -> bool
|
|
7
8
|
def close: () -> void
|
|
8
9
|
def consume: () -> void
|
|
9
10
|
def <<: (string) -> void
|
|
11
|
+
# def send: (Request) -> void
|
|
12
|
+
# def ping: () -> void
|
|
13
|
+
# def timeout: () -> (Integer | Float)
|
|
14
|
+
|
|
10
15
|
end
|
|
11
16
|
|
|
17
|
+
extend Forwardable
|
|
12
18
|
include Loggable
|
|
13
19
|
include Callbacks
|
|
14
|
-
|
|
20
|
+
include HTTPX::Registry[String, Class]
|
|
21
|
+
|
|
22
|
+
BUFFER_SIZE: Integer
|
|
15
23
|
|
|
16
|
-
attr_reader origin:
|
|
24
|
+
attr_reader origin: URI::Generic
|
|
17
25
|
attr_reader state: Symbol
|
|
18
26
|
attr_reader pending: Array[Request]
|
|
19
|
-
attr_reader options:
|
|
27
|
+
attr_reader options: Options
|
|
28
|
+
attr_writer timers: Timers
|
|
29
|
+
|
|
30
|
+
@origins: Array[URI::Generic]
|
|
31
|
+
@window_size: Integer
|
|
32
|
+
@read_buffer: Buffer
|
|
33
|
+
@write_buffer: Buffer
|
|
34
|
+
@inflight: Integer
|
|
35
|
+
@keep_alive_timeout: Numeric?
|
|
36
|
+
@total_timeout: Numeric?
|
|
20
37
|
|
|
21
38
|
def addresses: () -> Array[ipaddr]?
|
|
22
39
|
|
|
23
40
|
def addresses=: (Array[ipaddr]) -> void
|
|
24
41
|
|
|
25
|
-
def match?: (
|
|
42
|
+
def match?: (URI::Generic, options) -> bool
|
|
26
43
|
|
|
27
44
|
def mergeable?: (Connection) -> bool
|
|
28
45
|
|
|
29
46
|
def coalescable?: (Connection) -> bool
|
|
30
47
|
|
|
31
|
-
def create_idle: (options) -> Connection
|
|
32
|
-
| () -> Connection
|
|
48
|
+
def create_idle: (?Hash[Symbol, untyped] options) -> Connection
|
|
33
49
|
|
|
34
50
|
def merge: (Connection) -> void
|
|
35
51
|
|
|
36
52
|
def purge_pending: () { (Request) -> void } -> void
|
|
37
53
|
|
|
38
|
-
def match_altsvcs?: (
|
|
54
|
+
def match_altsvcs?: (URI::Generic uri) -> bool
|
|
39
55
|
|
|
40
56
|
def connecting?: () -> bool
|
|
57
|
+
|
|
41
58
|
def inflight?: () -> boolish
|
|
42
59
|
|
|
43
60
|
def interests: () -> io_interests?
|
|
44
61
|
|
|
45
|
-
def to_io: () ->
|
|
62
|
+
def to_io: () -> IO
|
|
46
63
|
|
|
47
64
|
def call: () -> void
|
|
48
65
|
|
|
@@ -53,9 +70,10 @@ module HTTPX
|
|
|
53
70
|
|
|
54
71
|
def timeout: () -> Numeric?
|
|
55
72
|
|
|
73
|
+
def deactivate: () -> void
|
|
56
74
|
private
|
|
57
75
|
|
|
58
|
-
def initialize: (String,
|
|
76
|
+
def initialize: (String, URI::Generic, options) -> untyped
|
|
59
77
|
|
|
60
78
|
def connect: () -> void
|
|
61
79
|
|
|
@@ -67,6 +85,8 @@ module HTTPX
|
|
|
67
85
|
|
|
68
86
|
def parser: () -> _Parser
|
|
69
87
|
|
|
88
|
+
def send_request_to_parser: (Request request) -> void
|
|
89
|
+
|
|
70
90
|
def build_parser: () -> _Parser
|
|
71
91
|
| (String) -> _Parser
|
|
72
92
|
|
|
@@ -74,12 +94,10 @@ module HTTPX
|
|
|
74
94
|
|
|
75
95
|
def transition: (Symbol) -> void
|
|
76
96
|
|
|
77
|
-
def
|
|
78
|
-
|
|
79
|
-
def on_error: (StandardError) -> void
|
|
97
|
+
def on_error: (HTTPX::TimeoutError | Error | StandardError) -> void
|
|
80
98
|
|
|
81
99
|
def handle_error: (StandardError) -> void
|
|
82
100
|
|
|
83
|
-
def
|
|
101
|
+
def purge_after_closed: () -> void
|
|
84
102
|
end
|
|
85
103
|
end
|
data/sig/errors.rbs
CHANGED
|
@@ -1,3 +1,37 @@
|
|
|
1
1
|
module HTTPX
|
|
2
|
-
Error
|
|
2
|
+
class Error < StandardError
|
|
3
|
+
end
|
|
4
|
+
|
|
5
|
+
class TimeoutError < Error
|
|
6
|
+
attr_reader timeout: Numeric
|
|
7
|
+
|
|
8
|
+
def to_connection_error: () -> ConnectTimeoutError
|
|
9
|
+
private
|
|
10
|
+
|
|
11
|
+
def initialize: (Numeric timeout, String message) -> untyped
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
class TotalTimeoutError < TimeoutError
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
class ConnectTimeoutError < TimeoutError
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
class SettingsTimeoutError < TimeoutError
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
class ResolveTimeoutError < TimeoutError
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
class ResolveError < Error
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
class NativeResolveError < ResolveError
|
|
30
|
+
attr_reader connection: Connection
|
|
31
|
+
attr_reader host: String
|
|
32
|
+
|
|
33
|
+
private
|
|
34
|
+
|
|
35
|
+
def initialize: (Connection connection, String hostname, ?String message) -> untyped
|
|
36
|
+
end
|
|
3
37
|
end
|
data/sig/headers.rbs
CHANGED
|
@@ -2,44 +2,45 @@ module HTTPX
|
|
|
2
2
|
class Headers
|
|
3
3
|
include _ToS
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
EMPTY: Array[untyped]
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
@headers: Hash[String, Array[String]]
|
|
8
|
+
|
|
9
|
+
def self.new: (?untyped headers) -> instance
|
|
8
10
|
|
|
9
11
|
def ==: (untyped other) -> bool
|
|
10
12
|
|
|
11
|
-
def []: (
|
|
12
|
-
def []=: (
|
|
13
|
+
def []: (String field) -> String?
|
|
14
|
+
def []=: (String field, headers_value value) -> void
|
|
13
15
|
|
|
14
|
-
def add: (
|
|
15
|
-
def delete: (
|
|
16
|
+
def add: (String field, string value) -> void
|
|
17
|
+
def delete: (String field) -> Array[String]?
|
|
16
18
|
|
|
17
|
-
def each: (?_Each[
|
|
18
|
-
| (?_Each[
|
|
19
|
+
def each: (?_Each[[String, String]]? extra_headers) { (String k, String v) -> void } -> void
|
|
20
|
+
| (?_Each[[String, String]]? extra_headers) -> Enumerable[[String, String]]
|
|
19
21
|
|
|
20
|
-
def get: (
|
|
21
|
-
def key?: (
|
|
22
|
+
def get: (String field) -> Array[String]
|
|
23
|
+
def key?: (String downcased_key) -> bool
|
|
22
24
|
|
|
23
|
-
def merge: (_Each[
|
|
25
|
+
def merge: (_Each[[String, headers_value]] other) -> Headers
|
|
24
26
|
|
|
25
27
|
def same_headers?: (untyped headers) -> bool
|
|
26
28
|
|
|
27
|
-
def to_a: () -> Array[[
|
|
28
|
-
def to_hash: () -> Hash[
|
|
29
|
+
def to_a: () -> Array[[String, String]]
|
|
30
|
+
def to_hash: () -> Hash[String, String]
|
|
29
31
|
alias to_h to_hash
|
|
30
32
|
|
|
31
|
-
def inspect: () -> String
|
|
33
|
+
def inspect: () -> String
|
|
32
34
|
|
|
33
35
|
private
|
|
34
36
|
|
|
35
|
-
def initialize: (headers?) -> untyped
|
|
37
|
+
def initialize: (?headers?) -> untyped
|
|
36
38
|
def array_value: (headers_value) -> Array[String]
|
|
37
|
-
def downcased: (
|
|
39
|
+
def downcased: (_ToS field) -> String
|
|
38
40
|
end
|
|
39
41
|
|
|
40
|
-
type headers_key = String | Symbol
|
|
41
42
|
type headers_value = _ToS | Array[_ToS]
|
|
42
|
-
type headers_hash = Hash[
|
|
43
|
-
type headers_input = headers_hash | Array[[
|
|
43
|
+
type headers_hash = Hash[_ToS, headers_value]
|
|
44
|
+
type headers_input = headers_hash | Array[[_ToS, string]]
|
|
44
45
|
type headers = Headers | headers_input
|
|
45
46
|
end
|
data/sig/httpx.rbs
CHANGED
|
@@ -4,12 +4,15 @@ module HTTPX
|
|
|
4
4
|
VERSION: String
|
|
5
5
|
|
|
6
6
|
type uri = URI::HTTP | URI::HTTPS | string
|
|
7
|
-
type generic_uri =
|
|
7
|
+
type generic_uri = String | URI::Generic
|
|
8
8
|
|
|
9
9
|
type verb = :options | :get | :head | :post | :put | :delete | :trace | :connect |
|
|
10
10
|
:propfind | :proppatch | :mkcol | :copy | :move | :lock | :unlock | :orderpatch |
|
|
11
11
|
:acl | :report | :patch | :search
|
|
12
12
|
|
|
13
13
|
module Plugins
|
|
14
|
+
def self?.load_plugin: (Symbol) -> Module
|
|
15
|
+
|
|
16
|
+
def self?.register_plugin: (Symbol, Module) -> void
|
|
14
17
|
end
|
|
15
18
|
end
|
data/sig/loggable.rbs
CHANGED
|
@@ -4,8 +4,10 @@ module HTTPX
|
|
|
4
4
|
end
|
|
5
5
|
|
|
6
6
|
module Loggable
|
|
7
|
+
COLORS: Hash[Symbol, Integer]
|
|
8
|
+
|
|
7
9
|
def log: (?level: Integer?, ?color: Symbol?) { () -> String } -> void
|
|
8
10
|
|
|
9
|
-
def log_exception: (
|
|
11
|
+
def log_exception: (Exception error, ?level: Integer, ?color: Symbol) -> void
|
|
10
12
|
end
|
|
11
13
|
end
|
data/sig/options.rbs
CHANGED
|
@@ -4,109 +4,120 @@ module HTTPX
|
|
|
4
4
|
|
|
5
5
|
WINDOW_SIZE: Integer
|
|
6
6
|
MAX_BODY_THRESHOLD_SIZE: Integer
|
|
7
|
+
CONNECT_TIMEOUT: Integer
|
|
8
|
+
OPERATION_TIMEOUT: Integer
|
|
9
|
+
KEEP_ALIVE_TIMEOUT: Integer
|
|
10
|
+
SETTINGS_TIMEOUT: Integer
|
|
11
|
+
DEFAULT_OPTIONS: Hash[Symbol, untyped]
|
|
7
12
|
|
|
8
13
|
type timeout_type = :connect_timeout | :settings_timeout | :operation_timeout | :keep_alive_timeout | :total_timeout
|
|
9
|
-
type timeout = Hash[timeout_type, Numeric
|
|
14
|
+
type timeout = Hash[timeout_type, Numeric]
|
|
10
15
|
|
|
11
|
-
def self.new: (options) -> instance
|
|
12
|
-
| () -> instance
|
|
16
|
+
def self.new: (?options) -> instance
|
|
13
17
|
|
|
18
|
+
def self.def_option: (Symbol, ?String) -> void
|
|
19
|
+
| (Symbol) { (*nil) -> untyped } -> void
|
|
14
20
|
# headers
|
|
15
21
|
attr_reader uri: URI?
|
|
16
|
-
def uri=: (uri) -> void
|
|
17
22
|
|
|
18
23
|
# headers
|
|
19
24
|
attr_reader headers: Headers?
|
|
20
|
-
def headers=: (headers) -> void
|
|
21
25
|
|
|
22
26
|
# timeout
|
|
23
27
|
attr_reader timeout: timeout
|
|
24
|
-
|
|
28
|
+
|
|
29
|
+
# http2_settings
|
|
30
|
+
attr_reader http2_settings: Hash[Symbol, Integer | bool]
|
|
25
31
|
|
|
26
32
|
# max_concurrent_requests
|
|
27
33
|
attr_reader max_concurrent_requests: Integer?
|
|
28
|
-
def max_concurrent_requests=: (Integer) -> void
|
|
29
34
|
|
|
30
35
|
# max_requests
|
|
31
36
|
attr_reader max_requests: Integer?
|
|
32
|
-
def max_requests=: (Integer) -> void
|
|
33
37
|
|
|
34
38
|
# window_size
|
|
35
|
-
attr_reader window_size:
|
|
36
|
-
def window_size=: (int) -> void
|
|
39
|
+
attr_reader window_size: Integer
|
|
37
40
|
|
|
38
41
|
# body_threshold_size
|
|
39
|
-
attr_reader body_threshold_size:
|
|
40
|
-
def body_threshold_size=: (int) -> void
|
|
42
|
+
attr_reader body_threshold_size: Integer
|
|
41
43
|
|
|
42
44
|
# transport
|
|
43
|
-
attr_reader transport:
|
|
44
|
-
def transport=: (_ToS) -> void
|
|
45
|
+
attr_reader transport: String?
|
|
45
46
|
|
|
46
47
|
# transport_options
|
|
47
48
|
attr_reader transport_options: Hash[untyped, untyped]?
|
|
48
|
-
def transport_options=: (Hash[untyped, untyped]) -> void
|
|
49
49
|
|
|
50
50
|
# addresses
|
|
51
|
-
attr_reader addresses:
|
|
52
|
-
def addresses=: (_ToAry[untyped]) -> void
|
|
51
|
+
attr_reader addresses: Array[ipaddr]?
|
|
53
52
|
|
|
54
53
|
# params
|
|
55
54
|
attr_reader params: Transcoder::urlencoded_input?
|
|
56
|
-
def params=: (Transcoder::urlencoded_input) -> void
|
|
57
55
|
|
|
58
56
|
# form
|
|
59
57
|
attr_reader form: Transcoder::urlencoded_input?
|
|
60
|
-
def form=: (Transcoder::urlencoded_input) -> void
|
|
61
58
|
|
|
62
59
|
# json
|
|
63
60
|
attr_reader json: _ToJson?
|
|
64
|
-
def json=: (_ToJson) -> void
|
|
65
61
|
|
|
66
62
|
# body
|
|
67
63
|
attr_reader body: bodyIO?
|
|
68
|
-
|
|
64
|
+
|
|
65
|
+
# body
|
|
66
|
+
attr_reader origin: URI::Generic?
|
|
69
67
|
|
|
70
68
|
# ssl
|
|
71
69
|
|
|
72
70
|
# http2_settings
|
|
73
71
|
|
|
72
|
+
|
|
73
|
+
# classes
|
|
74
|
+
attr_reader connection_class: singleton(Connection)
|
|
75
|
+
|
|
76
|
+
attr_reader request_class: singleton(Request)
|
|
77
|
+
|
|
78
|
+
attr_reader response_class: singleton(Response)
|
|
79
|
+
|
|
80
|
+
attr_reader headers_class: singleton(Headers)
|
|
81
|
+
|
|
82
|
+
attr_reader request_body_class: singleton(Request::Body)
|
|
83
|
+
|
|
84
|
+
attr_reader response_body_class: singleton(Response::Body)
|
|
85
|
+
|
|
86
|
+
attr_reader ssl: Hash[Symbol, untyped]
|
|
87
|
+
|
|
74
88
|
# request_class response_class headers_class request_body_class
|
|
75
89
|
# response_body_class connection_class
|
|
76
90
|
# resolver_class resolver_options
|
|
77
91
|
|
|
78
|
-
# request_class
|
|
79
|
-
attr_reader request_class: singleton(Request)
|
|
80
|
-
def request_class=: (singleton(Request)) -> void
|
|
81
|
-
|
|
82
92
|
# io
|
|
83
93
|
type io_option = _ToIO | Hash[String, _ToIO]
|
|
84
94
|
attr_reader io: io_option?
|
|
85
|
-
def io=: (io_option) -> void
|
|
86
95
|
|
|
87
96
|
# fallback_protocol
|
|
88
97
|
attr_reader fallback_protocol: String?
|
|
89
|
-
def fallback_protocol=: (String) -> void
|
|
90
98
|
|
|
91
99
|
# debug
|
|
92
100
|
attr_reader debug: _IOLogger?
|
|
93
|
-
def debug=: (_IOLogger) -> void
|
|
94
101
|
|
|
95
102
|
# debug_level
|
|
96
|
-
attr_reader debug_level: Integer
|
|
97
|
-
def debug_level=: (Integer) -> void
|
|
103
|
+
attr_reader debug_level: Integer
|
|
98
104
|
|
|
99
105
|
# persistent
|
|
100
106
|
attr_reader persistent: bool?
|
|
101
|
-
|
|
107
|
+
|
|
108
|
+
# resolver_options
|
|
109
|
+
attr_reader resolver_options: Hash[Symbol, untyped]?
|
|
102
110
|
|
|
103
111
|
def ==: (untyped other) -> bool
|
|
104
|
-
def merge: (_ToHash other) -> instance
|
|
112
|
+
def merge: (_ToHash[Symbol, untyped] other) -> instance
|
|
113
|
+
def to_hash: () -> Hash[Symbol, untyped]
|
|
105
114
|
|
|
106
115
|
private
|
|
107
116
|
|
|
108
|
-
|
|
117
|
+
REQUEST_IVARS: Array[Symbol]
|
|
118
|
+
|
|
119
|
+
def initialize: (?options options) -> untyped
|
|
109
120
|
end
|
|
110
121
|
|
|
111
|
-
type options = Options | Hash[Symbol
|
|
122
|
+
type options = Options | Hash[Symbol, untyped]
|
|
112
123
|
end
|
data/sig/parser/http1.rbs
CHANGED
|
@@ -5,9 +5,9 @@ module HTTPX
|
|
|
5
5
|
interface _HTTP1Events
|
|
6
6
|
|
|
7
7
|
def on_start: () -> void
|
|
8
|
-
def on_headers: (parsed_headers) -> void
|
|
9
|
-
def on_trailers: (parsed_headers) -> void
|
|
10
|
-
def on_data: (String) -> void
|
|
8
|
+
def on_headers: (parsed_headers headers) -> void
|
|
9
|
+
def on_trailers: (parsed_headers trailers) -> void
|
|
10
|
+
def on_data: (String data) -> void
|
|
11
11
|
def on_complete: () -> void
|
|
12
12
|
end
|
|
13
13
|
|
|
@@ -1,21 +1,43 @@
|
|
|
1
1
|
module HTTPX
|
|
2
2
|
module Plugins
|
|
3
3
|
module AwsSdkAuthentication
|
|
4
|
+
class Configuration
|
|
5
|
+
attr_reader profile: String?
|
|
6
|
+
|
|
7
|
+
private
|
|
8
|
+
|
|
9
|
+
def initialize: (String? profile) -> void
|
|
10
|
+
end
|
|
11
|
+
|
|
4
12
|
class Credentials
|
|
13
|
+
@aws_credentials: untyped
|
|
14
|
+
|
|
5
15
|
include _SigV4Credentials
|
|
16
|
+
|
|
17
|
+
private
|
|
18
|
+
|
|
19
|
+
def initialize: (untyped aws_credentials) -> untyped
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
interface _AwsSdkOptions
|
|
23
|
+
def aws_profile: () -> String?
|
|
6
24
|
end
|
|
7
25
|
|
|
8
26
|
def self.load_dependencies: (singleton(Session)) -> void
|
|
9
27
|
|
|
10
28
|
def self.configure: (singleton(Session)) -> void
|
|
11
29
|
|
|
12
|
-
def self.extra_options: (Options) -> (Options)
|
|
30
|
+
def self.extra_options: (Options) -> (Options & _AwsSdkOptions)
|
|
31
|
+
|
|
32
|
+
def self.credentials: (String? profile) -> Credentials
|
|
33
|
+
|
|
34
|
+
def self.region: (String? profile) -> String
|
|
13
35
|
|
|
14
36
|
module InstanceMethods
|
|
15
|
-
def aws_sdk_authentication: (**untyped) -> instance
|
|
37
|
+
def aws_sdk_authentication: (?credentials: Credentials, ?region: String, **untyped) -> instance
|
|
16
38
|
end
|
|
17
39
|
end
|
|
18
40
|
|
|
19
|
-
type sessionAwsSdkAuthentication =
|
|
41
|
+
type sessionAwsSdkAuthentication = awsSigV4Session & AwsSdkAuthentication::InstanceMethods
|
|
20
42
|
end
|
|
21
43
|
end
|
data/sig/plugins/aws_sigv4.rbs
CHANGED
|
@@ -9,13 +9,21 @@ module HTTPX
|
|
|
9
9
|
|
|
10
10
|
module AWSSigV4
|
|
11
11
|
|
|
12
|
-
Credentials
|
|
12
|
+
class Credentials < Struct[[String, String, String?]]
|
|
13
|
+
attr_reader username: String
|
|
14
|
+
attr_reader password: String
|
|
15
|
+
attr_reader security_token: String?
|
|
16
|
+
end
|
|
13
17
|
|
|
14
18
|
|
|
15
19
|
class Signer
|
|
16
20
|
|
|
17
|
-
|
|
21
|
+
@unsigned_headers: Set[String]
|
|
22
|
+
|
|
23
|
+
def sign!: (Request & RequestMethods request) -> void
|
|
18
24
|
|
|
25
|
+
def self.new: (instance) -> instance
|
|
26
|
+
| (**untyped params) -> instance
|
|
19
27
|
private
|
|
20
28
|
|
|
21
29
|
def initialize: (
|
|
@@ -33,16 +41,16 @@ module HTTPX
|
|
|
33
41
|
) -> untyped
|
|
34
42
|
|
|
35
43
|
|
|
36
|
-
def
|
|
44
|
+
def hexdigest: (bodyIO value) -> String
|
|
37
45
|
|
|
38
46
|
def hmac: (String key, String value) -> String
|
|
47
|
+
|
|
39
48
|
def hexhmac: (String key, String value) -> String
|
|
40
49
|
end
|
|
41
50
|
|
|
42
51
|
|
|
43
52
|
interface _SigV4Options
|
|
44
53
|
def sigv4_signer: () -> Signer?
|
|
45
|
-
def sigv4_signer=: (Signer) -> Signer
|
|
46
54
|
end
|
|
47
55
|
|
|
48
56
|
def self.extra_options: (Options) -> (Options & _SigV4Options)
|
|
@@ -59,6 +67,6 @@ module HTTPX
|
|
|
59
67
|
end
|
|
60
68
|
end
|
|
61
69
|
|
|
62
|
-
type awsSigV4Session = Session &
|
|
70
|
+
type awsSigV4Session = Session & AWSSigV4::InstanceMethods
|
|
63
71
|
end
|
|
64
72
|
end
|
|
@@ -10,6 +10,6 @@ module HTTPX
|
|
|
10
10
|
end
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
-
type sessionBasicAuthentication =
|
|
13
|
+
type sessionBasicAuthentication = sessionAuthentication & Authentication::InstanceMethods & BasicAuthentication::InstanceMethods
|
|
14
14
|
end
|
|
15
15
|
end
|
data/sig/plugins/compression.rbs
CHANGED
|
@@ -15,23 +15,21 @@ module HTTPX
|
|
|
15
15
|
|
|
16
16
|
def initialize: (Numeric bytesize) -> untyped
|
|
17
17
|
end
|
|
18
|
-
|
|
18
|
+
|
|
19
19
|
def self.configure: (singleton(Session)) -> void
|
|
20
20
|
|
|
21
21
|
interface _CompressionOptions
|
|
22
|
-
def compression_threshold_size: () ->
|
|
23
|
-
def compression_threshold_size=: (int) -> int
|
|
22
|
+
def compression_threshold_size: () -> Integer?
|
|
24
23
|
|
|
25
24
|
def encodings: () -> encodings_registry?
|
|
26
|
-
def encodings=: (encodings_registry) -> encodings_registry
|
|
27
25
|
end
|
|
28
|
-
|
|
26
|
+
|
|
29
27
|
def self.extra_options: (Options) -> (Options & _CompressionOptions)
|
|
30
28
|
|
|
31
29
|
|
|
32
30
|
module ResponseBodyMethods
|
|
33
31
|
@encodings: Array[String]
|
|
34
|
-
@_deflaters: Array[
|
|
32
|
+
@_deflaters: Array[_Deflater]
|
|
35
33
|
|
|
36
34
|
private
|
|
37
35
|
|
|
@@ -31,19 +31,17 @@ module HTTPX
|
|
|
31
31
|
|
|
32
32
|
def valid_for_uri?: (uri) -> bool
|
|
33
33
|
|
|
34
|
-
def self.new: (Cookie) ->
|
|
35
|
-
| (cookie_attributes) ->
|
|
36
|
-
| (
|
|
37
|
-
| (String, String, cookie_attributes) -> untyped
|
|
34
|
+
def self.new: (Cookie) -> instance
|
|
35
|
+
| (cookie_attributes) -> instance
|
|
36
|
+
| (_ToS, _ToS, ?cookie_attributes) -> instance
|
|
38
37
|
|
|
39
38
|
def self.path_match?: (String, String) -> bool
|
|
40
39
|
|
|
41
40
|
private
|
|
42
41
|
|
|
43
42
|
def initialize: (cookie_attributes) -> untyped
|
|
44
|
-
| (
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
| (_ToS, _ToS, ?cookie_attributes) -> untyped
|
|
44
|
+
|
|
47
45
|
def acceptable_from_uri?: (uri) -> bool
|
|
48
46
|
end
|
|
49
47
|
end
|