httpx 1.7.8 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/doc/release_notes/1_8_0.md +100 -0
- data/lib/httpx/adapters/datadog.rb +3 -1
- data/lib/httpx/connection/http1.rb +10 -1
- data/lib/httpx/connection/http2.rb +37 -4
- data/lib/httpx/connection.rb +76 -7
- data/lib/httpx/errors.rb +8 -1
- data/lib/httpx/io/tcp.rb +11 -1
- data/lib/httpx/options.rb +16 -4
- data/lib/httpx/parser/http1.rb +8 -2
- data/lib/httpx/plugins/auth.rb +52 -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/fiber_concurrency.rb +50 -3
- data/lib/httpx/plugins/ntlm_v2_auth.rb +92 -0
- data/lib/httpx/plugins/oauth.rb +66 -14
- data/lib/httpx/plugins/proxy.rb +5 -0
- 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 +16 -1
- data/lib/httpx/plugins/stream.rb +7 -3
- data/lib/httpx/plugins/tracing.rb +15 -4
- data/lib/httpx/request.rb +18 -1
- data/lib/httpx/resolver/cache/file.rb +56 -0
- data/lib/httpx/resolver/native.rb +14 -3
- data/lib/httpx/response/body.rb +4 -2
- data/lib/httpx/response.rb +9 -1
- data/lib/httpx/selector.rb +7 -1
- 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 +1 -1
- data/sig/connection.rbs +11 -8
- data/sig/errors.rbs +9 -3
- data/sig/httpx.rbs +2 -0
- data/sig/io/tcp.rbs +2 -0
- data/sig/loggable.rbs +4 -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/{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/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 +7 -3
- 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 +2 -2
- data/sig/resolver.rbs +3 -0
- data/sig/response.rbs +3 -0
- data/sig/selector.rbs +11 -8
- data/sig/timers.rbs +5 -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 +17 -7
data/lib/httpx/response.rb
CHANGED
|
@@ -68,7 +68,7 @@ module HTTPX
|
|
|
68
68
|
@headers = @options.headers_class.new(headers)
|
|
69
69
|
@body = @options.response_body_class.new(self, @options)
|
|
70
70
|
@finished = complete?
|
|
71
|
-
@content_type = nil
|
|
71
|
+
@content_type = @content_length = nil
|
|
72
72
|
end
|
|
73
73
|
|
|
74
74
|
# dupped initialization
|
|
@@ -88,6 +88,7 @@ module HTTPX
|
|
|
88
88
|
# merges headers defined in +h+ into the response headers.
|
|
89
89
|
def merge_headers(h)
|
|
90
90
|
@headers = @headers.merge(h)
|
|
91
|
+
@content_type = @content_length = nil
|
|
91
92
|
end
|
|
92
93
|
|
|
93
94
|
# writes +data+ chunk into the response body.
|
|
@@ -103,6 +104,13 @@ module HTTPX
|
|
|
103
104
|
@content_type ||= ContentType.new(@headers["content-type"])
|
|
104
105
|
end
|
|
105
106
|
|
|
107
|
+
# returns the response content length as advertised in the HTTP Content-Length header value.
|
|
108
|
+
def content_length
|
|
109
|
+
return @content_length if defined?(@content_length)
|
|
110
|
+
|
|
111
|
+
@content_length = @headers["content-length"]&.to_i
|
|
112
|
+
end
|
|
113
|
+
|
|
106
114
|
# returns whether the response has been fully fetched.
|
|
107
115
|
def finished?
|
|
108
116
|
@finished
|
data/lib/httpx/selector.rb
CHANGED
|
@@ -134,7 +134,13 @@ module HTTPX
|
|
|
134
134
|
# the connections to be reaped (such as the total timeout error) before #select
|
|
135
135
|
# gets called.
|
|
136
136
|
if @selectables.empty?
|
|
137
|
-
|
|
137
|
+
begin
|
|
138
|
+
sleep(interval)
|
|
139
|
+
rescue IOError
|
|
140
|
+
# @fiber-switch-guard
|
|
141
|
+
# in a fiber scheduler scenario, IOs may be closed by the scheduler and raised in a separate fiber
|
|
142
|
+
# on wakeup, which includes a sleep call.
|
|
143
|
+
end if interval
|
|
138
144
|
return
|
|
139
145
|
end
|
|
140
146
|
|
data/lib/httpx/version.rb
CHANGED
data/sig/chainable.rbs
CHANGED
|
@@ -16,6 +16,7 @@ module HTTPX
|
|
|
16
16
|
| (:basic_auth, ?options) -> Plugins::sessionBasicAuth
|
|
17
17
|
| (:digest_auth, ?options) -> Plugins::sessionDigestAuth
|
|
18
18
|
| (:ntlm_auth, ?options) -> Plugins::sessionNTLMAuth
|
|
19
|
+
| (:ntlm_v2_auth, ?options) -> Plugins::sessionNTLMV2Auth
|
|
19
20
|
| (:aws_sdk_authentication, ?options) -> Plugins::sessionAwsSdkAuthentication
|
|
20
21
|
| (:brotli, ?options) -> Session
|
|
21
22
|
| (:cookies, ?options) -> Plugins::sessionCookies
|
|
@@ -32,8 +33,10 @@ module HTTPX
|
|
|
32
33
|
| (:rate_limiter, ?options) -> Plugins::sessionRateLimiter
|
|
33
34
|
| (:stream, ?options) -> Plugins::sessionStream
|
|
34
35
|
| (:stream_bidi, ?options) -> Plugins::sessionStreamBidi
|
|
36
|
+
| (:server_sent_events, ?options) -> Plugins::sessionServerSentEvents
|
|
35
37
|
| (:aws_sigv4, ?options) -> Plugins::awsSigV4Session
|
|
36
38
|
| (:grpc, ?options) -> Plugins::grpcSession
|
|
39
|
+
| (:cache, ?options) -> Plugins::sessionCache
|
|
37
40
|
| (:response_cache, ?options) -> Plugins::sessionResponseCache
|
|
38
41
|
| (:circuit_breaker, ?options) -> Plugins::sessionCircuitBreaker
|
|
39
42
|
| (:oauth, ?options) -> Plugins::sessionOAuth
|
data/sig/connection/http1.rbs
CHANGED
data/sig/connection/http2.rbs
CHANGED
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]?
|
|
@@ -101,7 +102,7 @@ module HTTPX
|
|
|
101
102
|
|
|
102
103
|
def reset: () -> void
|
|
103
104
|
|
|
104
|
-
def timeout: () ->
|
|
105
|
+
def timeout: () -> interval?
|
|
105
106
|
|
|
106
107
|
def idling: () -> void
|
|
107
108
|
|
|
@@ -111,7 +112,7 @@ module HTTPX
|
|
|
111
112
|
|
|
112
113
|
def open?: () -> bool
|
|
113
114
|
|
|
114
|
-
def handle_socket_timeout: (
|
|
115
|
+
def handle_socket_timeout: (interval interval) -> void
|
|
115
116
|
|
|
116
117
|
def sibling=: (instance? connection) -> void
|
|
117
118
|
|
|
@@ -157,7 +158,7 @@ module HTTPX
|
|
|
157
158
|
|
|
158
159
|
def build_socket: (?Array[Resolver::Entry]? addrs) -> (TCP | SSL | UNIX)
|
|
159
160
|
|
|
160
|
-
def ping: () -> void
|
|
161
|
+
def ping: (Request request) -> void
|
|
161
162
|
|
|
162
163
|
def pong: () -> void
|
|
163
164
|
|
|
@@ -179,11 +180,13 @@ module HTTPX
|
|
|
179
180
|
|
|
180
181
|
def set_request_request_timeout: (Request request) -> void
|
|
181
182
|
|
|
183
|
+
def set_request_total_request_timeout: (Request request) -> void
|
|
184
|
+
|
|
182
185
|
def write_timeout_callback: (Request request, Numeric timeout) -> void
|
|
183
186
|
|
|
184
|
-
def read_timeout_callback: (Request request,
|
|
187
|
+
def read_timeout_callback: (Request request, interval timeout, ?singleton(RequestTimeoutError) error_type) -> void
|
|
185
188
|
|
|
186
|
-
def set_request_timeout: (Symbol label, Request request,
|
|
189
|
+
def set_request_timeout: (Symbol label, Request request, interval timeout, Symbol start_event, Symbol | Array[Symbol] finish_events) { () -> void } -> void
|
|
187
190
|
|
|
188
191
|
def parser_type: (String protocol) -> (singleton(HTTP1) | singleton(HTTP2))
|
|
189
192
|
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
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
|
@@ -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
|
|
@@ -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
|