httpx 1.7.8 → 1.8.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/doc/release_notes/1_7_1.md +1 -2
- data/doc/release_notes/1_8_0.md +100 -0
- data/doc/release_notes/1_8_1.md +27 -0
- data/lib/httpx/adapters/datadog.rb +12 -1
- data/lib/httpx/adapters/faraday.rb +2 -2
- data/lib/httpx/adapters/webmock.rb +6 -0
- data/lib/httpx/connection/http1.rb +15 -12
- data/lib/httpx/connection/http2.rb +69 -9
- data/lib/httpx/connection.rb +119 -21
- data/lib/httpx/errors.rb +8 -1
- data/lib/httpx/headers.rb +2 -2
- data/lib/httpx/io/ssl.rb +8 -9
- data/lib/httpx/io/tcp.rb +22 -5
- data/lib/httpx/io/unix.rb +2 -2
- data/lib/httpx/loggable.rb +11 -4
- data/lib/httpx/options.rb +16 -4
- data/lib/httpx/parser/http1.rb +8 -2
- data/lib/httpx/plugins/auth/digest.rb +1 -1
- data/lib/httpx/plugins/auth.rb +61 -4
- data/lib/httpx/plugins/{response_cache → cache}/file_store.rb +1 -1
- data/lib/httpx/plugins/{response_cache → cache}/store.rb +1 -1
- data/lib/httpx/plugins/cache.rb +221 -0
- data/lib/httpx/plugins/callbacks.rb +12 -0
- data/lib/httpx/plugins/digest_auth.rb +4 -0
- data/lib/httpx/plugins/fiber_concurrency.rb +75 -4
- data/lib/httpx/plugins/ntlm_v2_auth.rb +92 -0
- data/lib/httpx/plugins/oauth.rb +66 -14
- data/lib/httpx/plugins/persistent.rb +18 -2
- data/lib/httpx/plugins/proxy.rb +5 -0
- data/lib/httpx/plugins/push_promise.rb +2 -2
- data/lib/httpx/plugins/response_cache.rb +26 -105
- data/lib/httpx/plugins/retries.rb +7 -5
- data/lib/httpx/plugins/server_sent_events.rb +158 -0
- data/lib/httpx/plugins/ssrf_filter.rb +17 -2
- data/lib/httpx/plugins/stream.rb +9 -5
- data/lib/httpx/plugins/stream_bidi.rb +2 -0
- data/lib/httpx/plugins/tracing.rb +15 -4
- data/lib/httpx/pool.rb +2 -2
- data/lib/httpx/request/body.rb +2 -2
- data/lib/httpx/request.rb +42 -10
- data/lib/httpx/resolver/cache/base.rb +1 -8
- data/lib/httpx/resolver/cache/file.rb +56 -0
- data/lib/httpx/resolver/https.rb +20 -20
- data/lib/httpx/resolver/native.rb +21 -3
- data/lib/httpx/resolver/resolver.rb +4 -0
- data/lib/httpx/resolver/system.rb +5 -2
- data/lib/httpx/response/body.rb +6 -4
- data/lib/httpx/response.rb +12 -5
- data/lib/httpx/selector.rb +12 -1
- data/lib/httpx/session.rb +6 -1
- data/lib/httpx/session_extensions.rb +2 -2
- data/lib/httpx/timers.rb +3 -0
- data/lib/httpx/version.rb +1 -1
- data/sig/chainable.rbs +3 -0
- data/sig/connection/http1.rbs +1 -1
- data/sig/connection/http2.rbs +4 -1
- data/sig/connection.rbs +16 -9
- data/sig/errors.rbs +9 -3
- data/sig/httpx.rbs +2 -0
- data/sig/io/tcp.rbs +2 -0
- data/sig/loggable.rbs +8 -0
- data/sig/options.rbs +25 -12
- data/sig/parser/http1.rbs +3 -1
- data/sig/plugins/auth/ntlm.rbs +1 -1
- data/sig/plugins/auth.rbs +4 -0
- data/sig/plugins/{response_cache → cache}/file_store.rbs +2 -2
- data/sig/plugins/{response_cache → cache}/store.rbs +2 -2
- data/sig/plugins/cache.rbs +69 -0
- data/sig/plugins/fiber_concurrency.rbs +4 -0
- data/sig/plugins/ntlm_v2_auth.rbs +36 -0
- data/sig/plugins/persistent.rbs +3 -0
- data/sig/plugins/response_cache.rbs +13 -38
- data/sig/plugins/retries.rbs +5 -5
- data/sig/plugins/server_sent_events.rbs +45 -0
- data/sig/plugins/ssrf_filter.rbs +5 -1
- data/sig/plugins/stream.rbs +1 -1
- data/sig/plugins/stream_bidi.rbs +0 -2
- data/sig/plugins/webdav.rbs +1 -1
- data/sig/pool.rbs +2 -2
- data/sig/request.rbs +9 -6
- data/sig/resolver/cache/file.rbs +13 -0
- data/sig/resolver/entry.rbs +1 -1
- data/sig/resolver/https.rbs +3 -3
- data/sig/resolver/multi.rbs +1 -1
- data/sig/resolver/native.rbs +5 -5
- data/sig/resolver/resolver.rbs +1 -3
- data/sig/resolver/system.rbs +5 -2
- data/sig/resolver.rbs +3 -0
- data/sig/response.rbs +3 -0
- data/sig/selector.rbs +13 -8
- data/sig/timers.rbs +7 -5
- data/sig/transcoder/body.rbs +1 -1
- data/sig/transcoder/gzip.rbs +3 -2
- data/sig/transcoder/multipart.rbs +4 -1
- data/sig/transcoder/utils/deflater.rbs +2 -0
- data/sig/transcoder.rbs +2 -0
- data/sig/utils.rbs +1 -1
- metadata +19 -7
data/sig/connection/http2.rbs
CHANGED
|
@@ -16,6 +16,7 @@ module HTTPX
|
|
|
16
16
|
@max_requests: Integer
|
|
17
17
|
@drains: Hash[Request, String]
|
|
18
18
|
@pings: Array[String]
|
|
19
|
+
@streams_to_close_after_receive: Array[[HTTP2::Stream, Request, HTTPX::Error]]
|
|
19
20
|
@buffer: Buffer
|
|
20
21
|
@handshake_completed: bool
|
|
21
22
|
@wait_for_handshake: bool
|
|
@@ -42,7 +43,7 @@ module HTTPX
|
|
|
42
43
|
|
|
43
44
|
alias reset init_connection
|
|
44
45
|
|
|
45
|
-
def timeout: () ->
|
|
46
|
+
def timeout: () -> interval?
|
|
46
47
|
|
|
47
48
|
def reset_requests: () -> void
|
|
48
49
|
|
|
@@ -106,6 +107,8 @@ module HTTPX
|
|
|
106
107
|
|
|
107
108
|
def on_pong: (string ping) -> void
|
|
108
109
|
|
|
110
|
+
def emit_stream_error: (HTTP2::Stream stream, Request request, StandardError error) -> void
|
|
111
|
+
|
|
109
112
|
def teardown: (?Request? request) -> void
|
|
110
113
|
|
|
111
114
|
class Error < ::HTTPX::Error
|
data/sig/connection.rbs
CHANGED
|
@@ -38,9 +38,9 @@ module HTTPX
|
|
|
38
38
|
@write_buffer: Buffer
|
|
39
39
|
@inflight: Integer
|
|
40
40
|
@max_concurrent_requests: Integer?
|
|
41
|
-
@keep_alive_timeout:
|
|
42
|
-
@timeout:
|
|
43
|
-
@current_timeout:
|
|
41
|
+
@keep_alive_timeout: interval?
|
|
42
|
+
@timeout: interval?
|
|
43
|
+
@current_timeout: interval?
|
|
44
44
|
@parser: Object & _Parser
|
|
45
45
|
@connected_at: Float
|
|
46
46
|
@response_received_at: Float
|
|
@@ -51,6 +51,7 @@ module HTTPX
|
|
|
51
51
|
@sibling: instance?
|
|
52
52
|
@main_sibling: bool
|
|
53
53
|
@no_more_requests_counter: Integer
|
|
54
|
+
@ping_timer: Timers::Timer?
|
|
54
55
|
|
|
55
56
|
|
|
56
57
|
def addresses: () -> Array[Resolver::Entry]?
|
|
@@ -91,6 +92,8 @@ module HTTPX
|
|
|
91
92
|
|
|
92
93
|
def call: () -> void
|
|
93
94
|
|
|
95
|
+
def initial_call: () -> void
|
|
96
|
+
|
|
94
97
|
def terminate: () -> void
|
|
95
98
|
|
|
96
99
|
def close: () -> void
|
|
@@ -101,7 +104,7 @@ module HTTPX
|
|
|
101
104
|
|
|
102
105
|
def reset: () -> void
|
|
103
106
|
|
|
104
|
-
def timeout: () ->
|
|
107
|
+
def timeout: () -> interval?
|
|
105
108
|
|
|
106
109
|
def idling: () -> void
|
|
107
110
|
|
|
@@ -111,7 +114,7 @@ module HTTPX
|
|
|
111
114
|
|
|
112
115
|
def open?: () -> bool
|
|
113
116
|
|
|
114
|
-
def handle_socket_timeout: (
|
|
117
|
+
def handle_socket_timeout: (interval interval) -> void
|
|
115
118
|
|
|
116
119
|
def sibling=: (instance? connection) -> void
|
|
117
120
|
|
|
@@ -121,7 +124,7 @@ module HTTPX
|
|
|
121
124
|
|
|
122
125
|
def on_error: (HTTPX::TimeoutError | Error | StandardError error, ?Request? request) -> void
|
|
123
126
|
|
|
124
|
-
def on_io_error: (IOError error) -> void
|
|
127
|
+
def on_io_error: (SocketError | IOError | TLSError error) -> void
|
|
125
128
|
|
|
126
129
|
def on_connect_error: (Exception error) -> void
|
|
127
130
|
|
|
@@ -157,12 +160,14 @@ module HTTPX
|
|
|
157
160
|
|
|
158
161
|
def build_socket: (?Array[Resolver::Entry]? addrs) -> (TCP | SSL | UNIX)
|
|
159
162
|
|
|
160
|
-
def ping: () -> void
|
|
163
|
+
def ping: (Request request) -> void
|
|
161
164
|
|
|
162
165
|
def pong: () -> void
|
|
163
166
|
|
|
164
167
|
def no_more_requests_loop_check: () -> void
|
|
165
168
|
|
|
169
|
+
def no_more_requests?: () -> bool
|
|
170
|
+
|
|
166
171
|
def handle_error: (StandardError error, ?Request? request) -> void
|
|
167
172
|
|
|
168
173
|
def force_purge: () -> void
|
|
@@ -179,11 +184,13 @@ module HTTPX
|
|
|
179
184
|
|
|
180
185
|
def set_request_request_timeout: (Request request) -> void
|
|
181
186
|
|
|
187
|
+
def set_request_total_request_timeout: (Request request) -> void
|
|
188
|
+
|
|
182
189
|
def write_timeout_callback: (Request request, Numeric timeout) -> void
|
|
183
190
|
|
|
184
|
-
def read_timeout_callback: (Request request,
|
|
191
|
+
def read_timeout_callback: (Request request, interval timeout, ?singleton(RequestTimeoutError) error_type) -> void
|
|
185
192
|
|
|
186
|
-
def set_request_timeout: (Symbol label, Request request,
|
|
193
|
+
def set_request_timeout: (Symbol label, Request request, interval timeout, Symbol start_event, Symbol | Array[Symbol] finish_events) { () -> void } -> void
|
|
187
194
|
|
|
188
195
|
def parser_type: (String protocol) -> (singleton(HTTP1) | singleton(HTTP2))
|
|
189
196
|
end
|
data/sig/errors.rbs
CHANGED
|
@@ -9,12 +9,12 @@ module HTTPX
|
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
class TimeoutError < Error
|
|
12
|
-
attr_reader timeout:
|
|
12
|
+
attr_reader timeout: interval
|
|
13
13
|
|
|
14
14
|
def to_connection_error: () -> ConnectTimeoutError
|
|
15
15
|
private
|
|
16
16
|
|
|
17
|
-
def initialize: (
|
|
17
|
+
def initialize: (interval timeout, String message) -> untyped
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
class PoolTimeoutError < TimeoutError
|
|
@@ -33,7 +33,7 @@ module HTTPX
|
|
|
33
33
|
attr_reader request: Request
|
|
34
34
|
attr_reader response: response?
|
|
35
35
|
|
|
36
|
-
def initialize: (Request request, response? response,
|
|
36
|
+
def initialize: (Request request, response? response, interval timeout) -> void
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
class ReadTimeoutError < RequestTimeoutError
|
|
@@ -42,9 +42,15 @@ module HTTPX
|
|
|
42
42
|
class WriteTimeoutError < RequestTimeoutError
|
|
43
43
|
end
|
|
44
44
|
|
|
45
|
+
class TotalRequestTimeoutError < RequestTimeoutError
|
|
46
|
+
end
|
|
47
|
+
|
|
45
48
|
class OperationTimeoutError < TimeoutError
|
|
46
49
|
end
|
|
47
50
|
|
|
51
|
+
class PingTimeoutError < TimeoutError
|
|
52
|
+
end
|
|
53
|
+
|
|
48
54
|
class ResolveError < Error
|
|
49
55
|
end
|
|
50
56
|
|
data/sig/httpx.rbs
CHANGED
data/sig/io/tcp.rbs
CHANGED
data/sig/loggable.rbs
CHANGED
|
@@ -3,15 +3,23 @@ module HTTPX
|
|
|
3
3
|
def <<: (string?) -> void
|
|
4
4
|
end
|
|
5
5
|
|
|
6
|
+
interface _Loggable
|
|
7
|
+
def log: (?level: Integer?, ?color: Symbol?, ?debug_level: Integer, ?debug: _IOLogger?) { () -> String } -> void
|
|
8
|
+
end
|
|
9
|
+
|
|
6
10
|
module Loggable
|
|
7
11
|
USE_DEBUG_LOG: bool
|
|
8
12
|
|
|
9
13
|
COLORS: Hash[Symbol, Integer]
|
|
10
14
|
|
|
15
|
+
def self.log_identifiers: () -> String
|
|
16
|
+
|
|
11
17
|
def log: (?level: Integer?, ?color: Symbol?, ?debug_level: Integer, ?debug: _IOLogger?) { () -> String } -> void
|
|
12
18
|
|
|
13
19
|
def log_exception: (Exception error, ?level: Integer, ?color: Symbol, ?debug_level: Integer, ?debug: _IOLogger?) -> void
|
|
14
20
|
|
|
21
|
+
private
|
|
22
|
+
|
|
15
23
|
def log_redact_headers: (_ToS text) -> String
|
|
16
24
|
|
|
17
25
|
def log_redact_body: (_ToS text) -> String
|
data/sig/options.rbs
CHANGED
|
@@ -2,6 +2,8 @@ module HTTPX
|
|
|
2
2
|
class Options
|
|
3
3
|
# include _ToHash
|
|
4
4
|
|
|
5
|
+
type maybe_unbounded = Integer | Float # because infinity
|
|
6
|
+
|
|
5
7
|
BUFFER_SIZE: Integer
|
|
6
8
|
WINDOW_SIZE: Integer
|
|
7
9
|
MAX_BODY_THRESHOLD_SIZE: Integer
|
|
@@ -9,8 +11,10 @@ module HTTPX
|
|
|
9
11
|
READ_TIMEOUT: Integer
|
|
10
12
|
WRITE_TIMEOUT: Integer
|
|
11
13
|
REQUEST_TIMEOUT: Integer
|
|
14
|
+
TOTAL_REQUEST_TIMEOUT: Integer
|
|
12
15
|
OPERATION_TIMEOUT: Integer
|
|
13
16
|
KEEP_ALIVE_TIMEOUT: Integer
|
|
17
|
+
PING_TIMEOUT: Integer
|
|
14
18
|
SETTINGS_TIMEOUT: Integer
|
|
15
19
|
CLOSE_HANDSHAKE_TIMEOUT: Integer
|
|
16
20
|
SET_TEMPORARY_NAME: ^(Class klass, ?Symbol pl) -> void
|
|
@@ -21,8 +25,8 @@ module HTTPX
|
|
|
21
25
|
RESOLVER_TYPES: Array[Symbol]
|
|
22
26
|
USER_AGENT: String
|
|
23
27
|
|
|
24
|
-
type timeout_type = :connect_timeout | :settings_timeout | :close_handshake_timeout | :operation_timeout | :keep_alive_timeout | :read_timeout | :write_timeout | :request_timeout
|
|
25
|
-
type timeout = Hash[timeout_type,
|
|
28
|
+
type timeout_type = :connect_timeout | :settings_timeout | :close_handshake_timeout | :operation_timeout | :keep_alive_timeout | :read_timeout | :write_timeout | :total_request_timeout | :request_timeout | :ping_timeout
|
|
29
|
+
type timeout = Hash[timeout_type, interval?]
|
|
26
30
|
type redact_value = :headers | :body | bool
|
|
27
31
|
type resolver_cache_option = :memory | :file | (Object & Resolver::_Cache)
|
|
28
32
|
|
|
@@ -43,10 +47,10 @@ module HTTPX
|
|
|
43
47
|
attr_reader http2_settings: Hash[Symbol, Integer | bool]
|
|
44
48
|
|
|
45
49
|
# max_concurrent_requests
|
|
46
|
-
attr_reader max_concurrent_requests:
|
|
50
|
+
attr_reader max_concurrent_requests: maybe_unbounded?
|
|
47
51
|
|
|
48
52
|
# max_requests
|
|
49
|
-
attr_reader max_requests:
|
|
53
|
+
attr_reader max_requests: maybe_unbounded?
|
|
50
54
|
|
|
51
55
|
# window_size
|
|
52
56
|
attr_reader window_size: Integer
|
|
@@ -57,6 +61,15 @@ module HTTPX
|
|
|
57
61
|
# body_threshold_size
|
|
58
62
|
attr_reader body_threshold_size: Integer
|
|
59
63
|
|
|
64
|
+
# max_response_headers
|
|
65
|
+
attr_reader max_response_headers: Integer
|
|
66
|
+
|
|
67
|
+
# max_response_header_value_size
|
|
68
|
+
attr_reader max_response_header_value_size: maybe_unbounded?
|
|
69
|
+
|
|
70
|
+
# max_response_body_size
|
|
71
|
+
attr_reader max_response_body_size: maybe_unbounded
|
|
72
|
+
|
|
60
73
|
# transport
|
|
61
74
|
attr_reader transport: io_type | nil
|
|
62
75
|
|
|
@@ -164,12 +177,12 @@ module HTTPX
|
|
|
164
177
|
def access_option: (Hash[Symbol, untyped] | Object | nil obj, Symbol k, Hash[Symbol, Symbol]? ivar_map) -> untyped
|
|
165
178
|
|
|
166
179
|
# integer
|
|
167
|
-
def option_max_concurrent_requests: (
|
|
168
|
-
def option_max_requests: (
|
|
169
|
-
def option_window_size: (
|
|
170
|
-
def option_buffer_size: (
|
|
171
|
-
def option_body_threshold_size: (
|
|
172
|
-
def option_debug_level: (
|
|
180
|
+
def option_max_concurrent_requests: (int value) -> maybe_unbounded
|
|
181
|
+
def option_max_requests: (int value) -> maybe_unbounded
|
|
182
|
+
def option_window_size: (int value) -> Integer
|
|
183
|
+
def option_buffer_size: (int value) -> Integer
|
|
184
|
+
def option_body_threshold_size: (int value) -> Integer
|
|
185
|
+
def option_debug_level: (int value) -> Integer
|
|
173
186
|
|
|
174
187
|
# to hash
|
|
175
188
|
def option_ssl: (_ToHash[Symbol, untyped] value) -> Hash[Symbol, untyped]
|
|
@@ -186,7 +199,7 @@ module HTTPX
|
|
|
186
199
|
def option_connection_class: (singleton(Connection) value) -> singleton(Connection)
|
|
187
200
|
def option_options_class: (singleton(Options) value) -> singleton(Options)
|
|
188
201
|
def option_pool_class: (singleton(Pool) value) -> singleton(Pool)
|
|
189
|
-
def option_resolver_class: (Symbol |
|
|
202
|
+
def option_resolver_class: (Symbol | resolver_type value) -> (Symbol | resolver_type)
|
|
190
203
|
def option_io: (io_option value) -> io_option
|
|
191
204
|
def option_fallback_protocol: (String value) -> String
|
|
192
205
|
def option_debug: (_IOLogger value) -> _IOLogger
|
|
@@ -204,7 +217,7 @@ module HTTPX
|
|
|
204
217
|
|
|
205
218
|
def option_headers: (headers_input | Headers value) -> Headers
|
|
206
219
|
|
|
207
|
-
def option_timeout: (_ToHash[timeout_type,
|
|
220
|
+
def option_timeout: (_ToHash[timeout_type, interval?]) -> timeout
|
|
208
221
|
|
|
209
222
|
def option_supported_compression_formats: (_ToS | _ToAry[_ToS] value) -> Array[String]
|
|
210
223
|
|
data/sig/parser/http1.rbs
CHANGED
|
@@ -28,6 +28,8 @@ module HTTPX
|
|
|
28
28
|
@content_length: Integer
|
|
29
29
|
@_has_trailers: bool
|
|
30
30
|
@upgrade: bool
|
|
31
|
+
@max_headers: Options::maybe_unbounded
|
|
32
|
+
@max_header_value_size: Options::maybe_unbounded?
|
|
31
33
|
|
|
32
34
|
def <<: (string chunk) -> void
|
|
33
35
|
|
|
@@ -39,7 +41,7 @@ module HTTPX
|
|
|
39
41
|
|
|
40
42
|
private
|
|
41
43
|
|
|
42
|
-
def initialize: (_HTTP1Events observer) ->
|
|
44
|
+
def initialize: (_HTTP1Events observer, Options::maybe_unbounded max_headers, Options::maybe_unbounded? max_header_value_size) -> void
|
|
43
45
|
|
|
44
46
|
def nextstate: (Symbol state) -> void
|
|
45
47
|
|
data/sig/plugins/auth/ntlm.rbs
CHANGED
data/sig/plugins/auth.rbs
CHANGED
|
@@ -7,6 +7,10 @@ module HTTPX
|
|
|
7
7
|
def auth_header_value: () -> auth_header_value_type?
|
|
8
8
|
|
|
9
9
|
def auth_header_type: () -> String?
|
|
10
|
+
|
|
11
|
+
def auth_header_expires_at: () -> (^(Request request) -> _ToF?)?
|
|
12
|
+
|
|
13
|
+
def auth_header_expires_in: () -> Float?
|
|
10
14
|
end
|
|
11
15
|
|
|
12
16
|
module InstanceMethods
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
module HTTPX
|
|
2
|
+
module Plugins
|
|
3
|
+
module Cache
|
|
4
|
+
interface _CacheStore
|
|
5
|
+
def get: (cacheRequest request) -> cacheResponse?
|
|
6
|
+
|
|
7
|
+
def set: (cacheRequest request, cacheResponse response) -> void
|
|
8
|
+
|
|
9
|
+
def clear: () -> void
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
interface _CacheOptions
|
|
13
|
+
def cache_key: () -> String?
|
|
14
|
+
|
|
15
|
+
def cacheable_request: () -> ^(cacheRequest request) -> boolish
|
|
16
|
+
|
|
17
|
+
def cacheable_response: () -> ^(cacheRequest request, cacheResponse response) -> boolish
|
|
18
|
+
|
|
19
|
+
def valid_cached_response: () -> ^(cacheRequest request, cacheResponse response) -> boolish
|
|
20
|
+
|
|
21
|
+
def response_cache_store: () -> Store
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
module InstanceMethods
|
|
25
|
+
def clear_response_cache: () -> void
|
|
26
|
+
|
|
27
|
+
private
|
|
28
|
+
|
|
29
|
+
def cacheable_request?: (cacheRequest request) -> boolish
|
|
30
|
+
|
|
31
|
+
def cacheable_response?: (cacheRequest request, cacheResponse response) -> boolish
|
|
32
|
+
|
|
33
|
+
def valid_cached_response?: (cacheRequest request, cacheResponse cached_response) -> boolish
|
|
34
|
+
|
|
35
|
+
def prepare_cache: (cacheRequest request) -> void
|
|
36
|
+
|
|
37
|
+
def retrieve_cached_response: (cacheRequest request) -> cacheResponse?
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
module RequestMethods
|
|
41
|
+
attr_accessor cached_response: cacheResponse?
|
|
42
|
+
attr_reader options: cacheOptions
|
|
43
|
+
|
|
44
|
+
def response_cache_key: () -> String?
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
module ResponseMethods
|
|
48
|
+
attr_writer original_request: cacheRequest
|
|
49
|
+
|
|
50
|
+
@cached: bool
|
|
51
|
+
|
|
52
|
+
def original_request: () -> cacheRequest?
|
|
53
|
+
|
|
54
|
+
def cached?: () -> bool
|
|
55
|
+
|
|
56
|
+
def mark_as_cached!: () -> void
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
type cacheOptions = Options & _CacheOptions
|
|
61
|
+
|
|
62
|
+
type cacheRequest = Request & RequestMethods
|
|
63
|
+
|
|
64
|
+
type cacheResponse = Response & ResponseMethods
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
type sessionCache = Session & Cache::InstanceMethods
|
|
68
|
+
end
|
|
69
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
module HTTPX
|
|
2
|
+
module Plugins
|
|
3
|
+
module NTLMV2Auth
|
|
4
|
+
class Authenticator
|
|
5
|
+
@user: String
|
|
6
|
+
@password: String
|
|
7
|
+
@domain: String?
|
|
8
|
+
|
|
9
|
+
def can_authenticate?: (String? www_authenticate) -> boolish
|
|
10
|
+
|
|
11
|
+
def authenticate: (Request request, String authenticate) -> String
|
|
12
|
+
|
|
13
|
+
def negotiate: () -> String
|
|
14
|
+
|
|
15
|
+
private
|
|
16
|
+
|
|
17
|
+
def initialize: (string user, string password, ?domain: String?) -> void
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
interface _NTLMV2Options
|
|
21
|
+
def ntlm: () -> Authentication?
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def self.extra_options: (Options) -> (Options & _NTLMV2Options)
|
|
25
|
+
|
|
26
|
+
def self.load_dependencies: (singleton(Session) klass) -> void
|
|
27
|
+
|
|
28
|
+
module InstanceMethods
|
|
29
|
+
def ntlm_auth: (string user, string password, ?string? domain) -> instance
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
type sessionNTLMV2Auth = sessionAuth & NTLMV2Auth::InstanceMethods
|
|
35
|
+
end
|
|
36
|
+
end
|
data/sig/plugins/persistent.rbs
CHANGED
|
@@ -5,72 +5,47 @@ module HTTPX
|
|
|
5
5
|
CACHEABLE_STATUS_CODES: Array[Integer]
|
|
6
6
|
SUPPORTED_VARY_HEADERS: Array[String]
|
|
7
7
|
|
|
8
|
-
def self?.cacheable_response?: (::HTTPX::ErrorResponse |
|
|
8
|
+
def self?.cacheable_response?: (::HTTPX::ErrorResponse | responseCacheResponse response) -> bool
|
|
9
9
|
|
|
10
10
|
def self?.not_modified?: (response response) -> bool
|
|
11
11
|
|
|
12
12
|
interface _ResponseCacheOptions
|
|
13
|
-
def response_cache_store: () -> Store
|
|
14
|
-
|
|
15
13
|
def supported_vary_headers: () -> Array[String]
|
|
16
14
|
end
|
|
17
15
|
|
|
18
|
-
interface _ResponseCacheStore
|
|
19
|
-
def get: (cacheRequest request) -> cacheResponse?
|
|
20
|
-
|
|
21
|
-
def set: (cacheRequest request, cacheResponse response) -> void
|
|
22
|
-
|
|
23
|
-
def clear: () -> void
|
|
24
|
-
end
|
|
25
|
-
|
|
26
16
|
module InstanceMethods
|
|
27
|
-
@response_cache: Store
|
|
28
|
-
|
|
29
|
-
def clear_response_cache: () -> void
|
|
30
|
-
|
|
31
17
|
private
|
|
32
18
|
|
|
33
|
-
def
|
|
34
|
-
|
|
35
|
-
def cacheable_request?: (cacheRequest request) -> bool
|
|
36
|
-
|
|
37
|
-
def match_by_vary?: (cacheRequest request, cacheResponse response) -> bool
|
|
19
|
+
def match_by_vary?: (responseCacheRequest request, responseCacheResponse response) -> bool
|
|
38
20
|
end
|
|
39
21
|
|
|
40
22
|
module RequestMethods
|
|
41
|
-
attr_accessor cached_response:
|
|
42
|
-
attr_reader options:
|
|
23
|
+
attr_accessor cached_response: responseCacheResponse?
|
|
24
|
+
attr_reader options: responseCacheOptions
|
|
43
25
|
|
|
44
26
|
@response_cache_key: String
|
|
45
27
|
|
|
46
|
-
|
|
28
|
+
private
|
|
47
29
|
|
|
48
30
|
def cacheable_verb?: () -> bool
|
|
49
31
|
end
|
|
50
32
|
|
|
51
33
|
module ResponseMethods
|
|
52
|
-
attr_writer original_request: cacheRequest
|
|
53
|
-
|
|
54
34
|
attr_writer revalidated_at: Time
|
|
55
35
|
|
|
56
|
-
@cached: bool
|
|
57
36
|
@cache_control: Array[String]?
|
|
58
|
-
@vary: Array[String]?
|
|
59
|
-
@date: Time?
|
|
60
|
-
|
|
61
|
-
def original_request: () -> cacheRequest?
|
|
62
37
|
|
|
63
|
-
|
|
38
|
+
@vary: Array[String]?
|
|
64
39
|
|
|
65
|
-
|
|
40
|
+
@date: Time?
|
|
66
41
|
|
|
67
42
|
def copy_from_cached!: () -> void
|
|
68
43
|
|
|
69
44
|
def fresh?: () -> bool
|
|
70
45
|
|
|
71
|
-
|
|
46
|
+
%a{pure} def cache_control: () -> Array[String]?
|
|
72
47
|
|
|
73
|
-
|
|
48
|
+
%a{pure} def vary: () -> Array[String]?
|
|
74
49
|
|
|
75
50
|
private
|
|
76
51
|
|
|
@@ -80,13 +55,13 @@ module HTTPX
|
|
|
80
55
|
end
|
|
81
56
|
|
|
82
57
|
|
|
83
|
-
type
|
|
58
|
+
type responseCacheOptions = Options & Cache::_CacheOptions & _ResponseCacheOptions
|
|
84
59
|
|
|
85
|
-
type
|
|
60
|
+
type responseCacheRequest = Request & Cache::RequestMethods & RequestMethods
|
|
86
61
|
|
|
87
|
-
type
|
|
62
|
+
type responseCacheResponse = Response & Cache::ResponseMethods & ResponseMethods
|
|
88
63
|
end
|
|
89
64
|
|
|
90
|
-
type sessionResponseCache = Session & ResponseCache::InstanceMethods
|
|
65
|
+
type sessionResponseCache = Session & Cache::InstanceMethods & ResponseCache::InstanceMethods
|
|
91
66
|
end
|
|
92
67
|
end
|
data/sig/plugins/retries.rbs
CHANGED
|
@@ -5,21 +5,21 @@ module HTTPX
|
|
|
5
5
|
IDEMPOTENT_METHODS: Array[String]
|
|
6
6
|
RECONNECTABLE_ERRORS: Array[singleton(StandardError)]
|
|
7
7
|
RETRYABLE_ERRORS: Array[singleton(StandardError)]
|
|
8
|
-
DEFAULT_JITTER: ^(
|
|
8
|
+
DEFAULT_JITTER: ^(interval) -> interval
|
|
9
9
|
BACKOFF_ALGORITHMS: Array[Symbol]
|
|
10
10
|
|
|
11
|
-
def self?.retry_after_polynomial_backoff: (retriesRequest request, retriesResponse response) ->
|
|
11
|
+
def self?.retry_after_polynomial_backoff: (retriesRequest request, retriesResponse response) -> interval
|
|
12
12
|
|
|
13
|
-
def self?.retry_after_exponential_backoff: (retriesRequest request, retriesResponse response) ->
|
|
13
|
+
def self?.retry_after_exponential_backoff: (retriesRequest request, retriesResponse response) -> interval
|
|
14
14
|
|
|
15
15
|
interface _RetryCallback
|
|
16
16
|
def call: (retriesResponse response) -> bool?
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
interface _RetriesOptions
|
|
20
|
-
def retry_after: () -> (^(retriesRequest request, retriesResponse response) ->
|
|
20
|
+
def retry_after: () -> (^(retriesRequest request, retriesResponse response) -> interval | interval)?
|
|
21
21
|
|
|
22
|
-
def retry_jitter: () -> ^(
|
|
22
|
+
def retry_jitter: () -> ^(interval jitter) -> interval
|
|
23
23
|
|
|
24
24
|
def max_retries: () -> Integer
|
|
25
25
|
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
module HTTPX
|
|
2
|
+
module Plugins
|
|
3
|
+
module ServerSentEvents
|
|
4
|
+
def self.load_dependencies: (singleton(Session)) -> void
|
|
5
|
+
|
|
6
|
+
def self.subplugins: () -> Hash[Symbol, Module]
|
|
7
|
+
|
|
8
|
+
class Message
|
|
9
|
+
attr_reader data: String
|
|
10
|
+
attr_reader id: _ToS?
|
|
11
|
+
attr_reader event: _ToS?
|
|
12
|
+
attr_reader retry_after: Integer?
|
|
13
|
+
|
|
14
|
+
def initialize: (data: String, ?event: _ToS?, ?id: _ToS?, ?retry_after: Integer?) -> void
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
interface _ServerSentEventsOptions
|
|
18
|
+
def event_stream: () -> boolish
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
module InstanceMethods
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
module RequestMethods
|
|
25
|
+
attr_accessor last_server_sent_message: Message?
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
module StreamResponseMethods
|
|
29
|
+
def each_message: () { (Message) -> void } -> void
|
|
30
|
+
| () -> Enumerable[Message]
|
|
31
|
+
|
|
32
|
+
private
|
|
33
|
+
|
|
34
|
+
def raise_format_error: (String line) -> void
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
module ServerSentEventsRetries
|
|
38
|
+
module InstanceMethods
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
type sessionServerSentEvents = Session & ServerSentEvents::InstanceMethods
|
|
44
|
+
end
|
|
45
|
+
end
|
data/sig/plugins/ssrf_filter.rbs
CHANGED
|
@@ -8,10 +8,14 @@ module HTTPX
|
|
|
8
8
|
|
|
9
9
|
IPV6_BLACKLIST: Array[[IPAddr, IPAddr]]
|
|
10
10
|
|
|
11
|
-
def self?.unsafe_ip_address?: (
|
|
11
|
+
def self?.unsafe_ip_address?: (IPAddr ipaddr) -> bool
|
|
12
12
|
|
|
13
13
|
interface _Options
|
|
14
14
|
def allowed_schemes: () -> Array[String]
|
|
15
|
+
|
|
16
|
+
def extra_unsafe_ranges: () -> Array[IPAddr]?
|
|
17
|
+
|
|
18
|
+
def safe_private_ranges: () -> Array[IPAddr]?
|
|
15
19
|
end
|
|
16
20
|
|
|
17
21
|
module InstanceMethods
|