httpx 0.15.1 → 0.16.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_15_2.md +9 -0
- data/doc/release_notes/0_15_3.md +5 -0
- data/doc/release_notes/0_15_4.md +5 -0
- data/doc/release_notes/0_16_0.md +93 -0
- data/lib/httpx.rb +6 -3
- data/lib/httpx/adapters/faraday.rb +3 -11
- data/lib/httpx/buffer.rb +1 -1
- data/lib/httpx/callbacks.rb +1 -1
- data/lib/httpx/chainable.rb +15 -8
- data/lib/httpx/connection.rb +2 -2
- data/lib/httpx/connection/http1.rb +3 -1
- data/lib/httpx/connection/http2.rb +1 -11
- data/lib/httpx/errors.rb +11 -11
- data/lib/httpx/io/ssl.rb +2 -2
- data/lib/httpx/io/tls.rb +1 -1
- data/lib/httpx/loggable.rb +1 -1
- data/lib/httpx/options.rb +81 -74
- data/lib/httpx/parser/http1.rb +1 -1
- data/lib/httpx/plugins/aws_sigv4.rb +10 -9
- data/lib/httpx/plugins/compression.rb +12 -11
- data/lib/httpx/plugins/cookies.rb +20 -7
- data/lib/httpx/plugins/cookies/cookie.rb +4 -3
- data/lib/httpx/plugins/cookies/jar.rb +24 -1
- data/lib/httpx/plugins/digest_authentication.rb +15 -11
- data/lib/httpx/plugins/expect.rb +19 -15
- data/lib/httpx/plugins/follow_redirects.rb +9 -9
- data/lib/httpx/plugins/grpc.rb +73 -47
- data/lib/httpx/plugins/grpc/call.rb +4 -1
- data/lib/httpx/plugins/ntlm_authentication.rb +8 -6
- data/lib/httpx/plugins/proxy.rb +4 -6
- 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 +9 -9
- data/lib/httpx/plugins/retries.rb +25 -21
- data/lib/httpx/plugins/upgrade.rb +7 -6
- data/lib/httpx/registry.rb +1 -1
- data/lib/httpx/request.rb +4 -12
- data/lib/httpx/resolver/https.rb +0 -2
- data/lib/httpx/response.rb +45 -18
- data/lib/httpx/selector.rb +13 -12
- data/lib/httpx/session.rb +19 -8
- data/lib/httpx/session2.rb +21 -0
- data/lib/httpx/transcoder/body.rb +1 -1
- data/lib/httpx/transcoder/chunker.rb +2 -1
- data/lib/httpx/version.rb +1 -1
- data/sig/buffer.rbs +2 -0
- data/sig/chainable.rbs +24 -28
- data/sig/connection.rbs +20 -8
- data/sig/connection/http1.rbs +3 -3
- data/sig/connection/http2.rbs +1 -1
- data/sig/errors.rbs +35 -1
- data/sig/headers.rbs +5 -5
- data/sig/httpx.rbs +4 -1
- data/sig/loggable.rbs +3 -1
- data/sig/options.rbs +35 -32
- data/sig/plugins/authentication.rbs +1 -1
- data/sig/plugins/aws_sdk_authentication.rbs +5 -1
- data/sig/plugins/aws_sigv4.rbs +1 -2
- data/sig/plugins/basic_authentication.rbs +1 -1
- data/sig/plugins/compression.rbs +4 -6
- data/sig/plugins/cookies.rbs +4 -5
- data/sig/plugins/cookies/cookie.rbs +5 -7
- data/sig/plugins/cookies/jar.rbs +9 -10
- 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 +2 -4
- data/sig/plugins/ntlm_authentication.rbs +2 -3
- data/sig/plugins/persistent.rbs +3 -8
- data/sig/plugins/proxy.rbs +7 -7
- data/sig/plugins/proxy/ssh.rbs +4 -4
- data/sig/plugins/push_promise.rbs +0 -2
- data/sig/plugins/retries.rbs +4 -8
- data/sig/plugins/stream.rbs +1 -1
- data/sig/plugins/upgrade.rbs +2 -3
- data/sig/pool.rbs +1 -2
- data/sig/registry.rbs +1 -1
- data/sig/request.rbs +2 -2
- data/sig/resolver.rbs +7 -0
- data/sig/resolver/native.rbs +9 -5
- data/sig/resolver/resolver_mixin.rbs +4 -5
- data/sig/resolver/system.rbs +2 -0
- data/sig/response.rbs +17 -11
- data/sig/selector.rbs +7 -6
- data/sig/session.rbs +19 -14
- data/sig/transcoder.rbs +11 -4
- data/sig/transcoder/body.rbs +6 -1
- data/sig/transcoder/chunker.rbs +8 -2
- data/sig/transcoder/form.rbs +2 -1
- data/sig/transcoder/json.rbs +1 -0
- data/sig/utils.rbs +2 -0
- metadata +12 -2
data/sig/plugins/stream.rbs
CHANGED
data/sig/plugins/upgrade.rbs
CHANGED
@@ -7,9 +7,8 @@ module HTTPX
|
|
7
7
|
|
8
8
|
interface _UpgradeOptions
|
9
9
|
def upgrade_handlers: () -> handlers_registry?
|
10
|
-
def upgrade_handlers=: (handlers_registry) -> handlers_registry
|
11
10
|
end
|
12
|
-
|
11
|
+
|
13
12
|
def self.extra_options: (Options) -> (Options & _UpgradeOptions)
|
14
13
|
|
15
14
|
module ConnectionMethods
|
@@ -18,6 +17,6 @@ module HTTPX
|
|
18
17
|
|
19
18
|
def hijack_io: () -> void
|
20
19
|
end
|
21
|
-
end
|
20
|
+
end
|
22
21
|
end
|
23
22
|
end
|
data/sig/pool.rbs
CHANGED
data/sig/registry.rbs
CHANGED
data/sig/request.rbs
CHANGED
@@ -14,11 +14,11 @@ module HTTPX
|
|
14
14
|
attr_reader response: response?
|
15
15
|
attr_reader drain_error: StandardError?
|
16
16
|
|
17
|
-
def initialize: (verb | String,
|
17
|
+
def initialize: (verb | String, generic_uri, ?options?) -> untyped
|
18
18
|
|
19
19
|
def interests: () -> (:r | :w)
|
20
20
|
|
21
|
-
def merge_headers: (
|
21
|
+
def merge_headers: (_Each[[headers_key, headers_value]]) -> void
|
22
22
|
|
23
23
|
def scheme: () -> ("http" | "https")
|
24
24
|
|
data/sig/resolver.rbs
CHANGED
@@ -4,6 +4,13 @@ module HTTPX
|
|
4
4
|
type resolver = Resolver::System | Resolver::Native | Resolver::HTTPS
|
5
5
|
|
6
6
|
module Resolver
|
7
|
+
RESOLVE_TIMEOUT: Integer | Float
|
8
|
+
|
9
|
+
def self.registry: (Symbol tag) -> Class
|
10
|
+
| () -> Hash[Symbol, Class]
|
11
|
+
|
12
|
+
def self.register: (Symbol tag, Class handler) -> void
|
13
|
+
|
7
14
|
type dns_resource = singleton(Resolv::DNS::Resource)
|
8
15
|
|
9
16
|
type dns_result = { "name" => String, "TTL" => Numeric, "alias" => String }
|
data/sig/resolver/native.rbs
CHANGED
@@ -1,9 +1,13 @@
|
|
1
1
|
module HTTPX
|
2
2
|
module Resolver
|
3
3
|
class Native
|
4
|
+
extend Forwardable
|
4
5
|
include ResolverMixin
|
5
6
|
include _ToIO
|
6
7
|
|
8
|
+
DEFAULTS: Hash[Symbol, untyped]
|
9
|
+
DNS_PORT: Integer
|
10
|
+
|
7
11
|
@options: Options
|
8
12
|
@ns_index: Integer
|
9
13
|
@resolver_options: Hash[Symbol, untyped]
|
@@ -15,7 +19,7 @@ module HTTPX
|
|
15
19
|
@queries: Hash[String, Connection]
|
16
20
|
@read_buffer: String
|
17
21
|
@write_buffer: Buffer
|
18
|
-
@state: :idle | :closed
|
22
|
+
@state: :idle | :open | :closed
|
19
23
|
|
20
24
|
def closed?: () -> bool
|
21
25
|
|
@@ -35,6 +39,8 @@ module HTTPX
|
|
35
39
|
|
36
40
|
def initialize: (options) -> untyped
|
37
41
|
|
42
|
+
def calculate_interests: () -> (:r | :w)
|
43
|
+
|
38
44
|
def consume: () -> void
|
39
45
|
|
40
46
|
def do_retry: () -> void
|
@@ -46,15 +52,13 @@ module HTTPX
|
|
46
52
|
|
47
53
|
def parse: (String) -> void
|
48
54
|
|
49
|
-
def resolve: (Connection, String hostname) -> void
|
50
|
-
| (Connection) -> void
|
51
|
-
| () -> void
|
55
|
+
def resolve: (?Connection connection, ?String hostname) -> void
|
52
56
|
|
53
57
|
def build_socket: () -> void
|
54
58
|
|
55
59
|
def transition: (Symbol nextstate) -> void
|
56
60
|
|
57
|
-
def handle_error: (StandardError) -> void
|
61
|
+
def handle_error: (NativeResolveError | StandardError) -> void
|
58
62
|
end
|
59
63
|
end
|
60
64
|
end
|
@@ -4,6 +4,8 @@ module HTTPX
|
|
4
4
|
include Callbacks
|
5
5
|
include Loggable
|
6
6
|
|
7
|
+
CHECK_IF_IP: Proc
|
8
|
+
|
7
9
|
def uncache: (Connection) -> void
|
8
10
|
|
9
11
|
private
|
@@ -16,12 +18,9 @@ module HTTPX
|
|
16
18
|
|
17
19
|
def system_resolve: (String hostname) -> Array[ipaddr]?
|
18
20
|
|
19
|
-
def emit_resolve_error: (Connection, String hostname, StandardError) -> void
|
20
|
-
| (Connection, String hostname) -> void
|
21
|
-
| (Connection) -> void
|
21
|
+
def emit_resolve_error: (Connection, ?String hostname, ?StandardError) -> void
|
22
22
|
|
23
|
-
def resolve_error: (String hostname, StandardError?) -> void
|
24
|
-
| (String hostname) -> void
|
23
|
+
def resolve_error: (String hostname, ?StandardError?) -> void
|
25
24
|
end
|
26
25
|
end
|
27
26
|
end
|
data/sig/resolver/system.rbs
CHANGED
data/sig/response.rbs
CHANGED
@@ -1,15 +1,17 @@
|
|
1
1
|
module HTTPX
|
2
2
|
interface _Response
|
3
|
-
def raise_for_status: () -> void
|
3
|
+
def raise_for_status: () -> void
|
4
4
|
end
|
5
5
|
|
6
6
|
class Response
|
7
|
+
extend Forwardable
|
8
|
+
|
7
9
|
include _Response
|
8
10
|
include _ToS
|
9
11
|
include _Reader
|
10
12
|
|
11
|
-
attr_reader status:
|
12
|
-
attr_reader headers:
|
13
|
+
attr_reader status: Integer
|
14
|
+
attr_reader headers: Headers
|
13
15
|
attr_reader body: Body
|
14
16
|
attr_reader version: String
|
15
17
|
|
@@ -18,50 +20,54 @@ module HTTPX
|
|
18
20
|
|
19
21
|
def copy_to: (_ToPath | _Writer destination) -> void
|
20
22
|
def close: () -> void
|
21
|
-
def uri: () ->
|
23
|
+
def uri: () -> URI::Generic
|
22
24
|
|
23
|
-
def merge_headers: (
|
25
|
+
def merge_headers: (_Each[[headers_key, headers_value]]) -> void
|
24
26
|
def bodyless?: () -> bool
|
25
27
|
def content_type: () -> ContentType
|
26
28
|
def complete?: () -> bool
|
27
29
|
|
28
30
|
private
|
29
31
|
|
30
|
-
def initialize: (Request,
|
32
|
+
def initialize: (Request request, String | Integer status, String version, headers?) -> untyped
|
31
33
|
def no_data?: () -> bool
|
32
34
|
|
33
35
|
class Body
|
34
|
-
include _Writer
|
35
36
|
include _Reader
|
36
37
|
include _ToS
|
37
38
|
include _ToStr
|
38
39
|
|
39
|
-
@state: :idle | :memory | :buffer
|
40
|
+
@state: :idle | :memory | :buffer | :closed
|
40
41
|
@threshold_size: Integer
|
41
42
|
@window_size: Integer
|
42
43
|
|
44
|
+
def write:(String chunk) -> Integer?
|
45
|
+
|
43
46
|
def each: () { (String) -> void } -> void
|
44
47
|
| () -> Enumerable[String]
|
45
48
|
|
46
49
|
def bytesize: () -> Numeric
|
47
50
|
def empty?: () -> bool
|
48
|
-
def copy_to: (
|
51
|
+
def copy_to: (String | File | _Writer destination) -> void
|
49
52
|
def close: () -> void
|
50
53
|
def closed?: () -> bool
|
51
54
|
|
52
55
|
private
|
53
56
|
|
54
|
-
def initialize: (Response,
|
57
|
+
def initialize: (Response, Options) -> untyped
|
55
58
|
def rewind: () -> void
|
56
59
|
def transition: () -> void
|
57
60
|
end
|
58
61
|
end
|
59
62
|
|
60
63
|
class ContentType
|
64
|
+
MIME_TYPE_RE: Regexp
|
65
|
+
CHARSET_RE: Regexp
|
66
|
+
|
61
67
|
attr_reader mime_type: String?
|
62
68
|
attr_reader charset: String?
|
63
69
|
|
64
|
-
def self.parse: (_ToS) ->
|
70
|
+
def self.parse: (_ToS) -> ContentType
|
65
71
|
def self.mime_type: (_ToS) -> String?
|
66
72
|
def self.charset: (_ToS) -> String?
|
67
73
|
|
data/sig/selector.rbs
CHANGED
@@ -1,19 +1,20 @@
|
|
1
1
|
module HTTPX
|
2
2
|
class Selector
|
3
|
-
READABLE:
|
4
|
-
WRITABLE:
|
3
|
+
READABLE: Array[Symbol]
|
4
|
+
WRITABLE: Array[Symbol]
|
5
|
+
@selectables: Array[_ToIO]
|
5
6
|
|
6
7
|
def register: (_ToIO) -> void
|
7
8
|
def deregister: (_ToIO) -> void
|
8
9
|
|
9
|
-
def select: (Numeric?) { (_ToIO) -> void } -> void
|
10
|
-
|
10
|
+
def select: (Numeric? interval) { (_ToIO) -> void } -> void
|
11
|
+
|
11
12
|
private
|
12
13
|
|
13
14
|
def initialize: () -> untyped
|
14
15
|
|
15
|
-
def select_many: (Numeric?) { (_ToIO) -> void } -> void
|
16
|
-
def select_one: (Numeric?) { (_ToIO) -> void } -> void
|
16
|
+
def select_many: (Numeric? interval) { (_ToIO) -> void } -> void
|
17
|
+
def select_one: (Numeric? interval) { (_ToIO) -> void } -> void
|
17
18
|
end
|
18
19
|
|
19
20
|
type io_interests = :r | :w | :rw
|
data/sig/session.rbs
CHANGED
@@ -3,21 +3,23 @@ module HTTPX
|
|
3
3
|
include Loggable
|
4
4
|
include Chainable
|
5
5
|
|
6
|
+
EMPTY_HASH: Hash[untyped, untyped]
|
7
|
+
|
6
8
|
@options: Options
|
7
|
-
@responses: Hash[Request,
|
8
|
-
@persistent: bool
|
9
|
+
@responses: Hash[Request, response]
|
10
|
+
@persistent: bool?
|
9
11
|
|
10
12
|
def wrap: () { (instance) -> void } -> void
|
11
|
-
|
13
|
+
|
12
14
|
def close: (*untyped) -> void
|
13
15
|
|
14
16
|
def request: (*Request, **untyped) -> (response | Array[response])
|
15
17
|
| (*untyped, **untyped) -> (response | Array[response])
|
16
18
|
|
17
|
-
def build_request: (String | verb,
|
19
|
+
def build_request: (String | verb, generic_uri, ?options) -> Request
|
18
20
|
|
19
|
-
def self.plugin: (Symbol | Module, ?options) { (Class) -> void } -> singleton(Session)
|
20
|
-
|
21
|
+
# def self.plugin: (Symbol | Module, ?options) { (Class) -> void } -> singleton(Session)
|
22
|
+
# | (Symbol | Module, ?options) -> singleton(Session)
|
21
23
|
|
22
24
|
|
23
25
|
|
@@ -25,28 +27,31 @@ module HTTPX
|
|
25
27
|
|
26
28
|
private
|
27
29
|
|
28
|
-
def initialize: (?options
|
29
|
-
| (?options
|
30
|
+
def initialize: (?options) { (instance) -> void } -> untyped
|
31
|
+
| (?options) -> untyped
|
30
32
|
|
31
33
|
def pool: -> Pool
|
32
34
|
def on_response: (Request, response) -> void
|
33
35
|
def on_promise: (untyped, untyped) -> void
|
34
|
-
def fetch_response: (Request,
|
36
|
+
def fetch_response: (Request request, untyped, untyped) -> response?
|
37
|
+
|
38
|
+
def find_connection: (Request, Array[Connection] connections, Options options) -> Connection
|
39
|
+
|
35
40
|
def set_connection_callbacks: (Connection, Array[Connection], Options) -> void
|
36
41
|
|
37
|
-
def build_altsvc_connection: (Connection, Array[Connection], URI, String, Hash[String, String], Options) -> Connection?
|
42
|
+
def build_altsvc_connection: (Connection, Array[Connection], URI::Generic, String, Hash[String, String], Options) -> Connection?
|
38
43
|
|
39
44
|
def build_requests: (verb | string, uri, options) -> Array[Request]
|
40
45
|
| (Array[[verb | string, uri, options]], options) -> Array[Request]
|
41
46
|
| (Array[[verb | string, uri]], options) -> Array[Request]
|
42
|
-
| (verb | string, _Each[[uri, options]
|
43
|
-
| (verb | string, _Each[uri
|
47
|
+
| (verb | string, _Each[[uri, options]], Options) -> Array[Request]
|
48
|
+
| (verb | string, _Each[uri], options) -> Array[Request]
|
44
49
|
|
45
|
-
def build_connection: (URI, Options) -> Connection
|
50
|
+
def build_connection: (URI::Generic, Options) -> Connection
|
46
51
|
|
47
52
|
def send_requests: (*Request, options) -> Array[response]
|
48
53
|
|
49
|
-
def _send_requests: (Array[Request],
|
54
|
+
def _send_requests: (Array[Request], Options) -> Array[Connection]
|
50
55
|
|
51
56
|
def receive_requests: (Array[Request], Array[Connection], options) -> Array[response]
|
52
57
|
end
|
data/sig/transcoder.rbs
CHANGED
@@ -1,11 +1,18 @@
|
|
1
1
|
module HTTPX
|
2
|
-
type bodyIO = _Reader | _Each[String, untyped] | _ToS
|
2
|
+
type bodyIO = _Reader | _Each[[String, untyped]] | _ToS
|
3
3
|
|
4
4
|
module Transcoder
|
5
|
-
|
5
|
+
def self?.registry: (String tag) -> _Encode
|
6
|
+
| () -> Hash[String, _Encode]
|
6
7
|
|
7
|
-
def self
|
8
|
-
|
8
|
+
def self?.register: (String tag, _Encode handler) -> void
|
9
|
+
|
10
|
+
def self?.normalize_keys: (_ToS key, _ToAry[untyped] | _ToHash[_ToS, untyped] | untyped value) { (String, ?untyped) -> void } -> void
|
11
|
+
| (_ToS key, untyped value, Proc? cond) { (String, untyped) -> void } -> void
|
12
|
+
|
13
|
+
interface _Encode
|
14
|
+
def encode: (untyped payload) -> (_Encoder | _Each[String])
|
15
|
+
end
|
9
16
|
|
10
17
|
interface _Encoder
|
11
18
|
def bytesize: () -> Numeric
|
data/sig/transcoder/body.rbs
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
module HTTPX
|
2
2
|
module Transcoder
|
3
3
|
module Body
|
4
|
+
class Error < HTTPX::Error
|
5
|
+
end
|
6
|
+
|
4
7
|
class Encoder
|
8
|
+
extend Forwardable
|
9
|
+
|
5
10
|
include _Encoder
|
6
11
|
include _ToS
|
7
12
|
|
@@ -11,7 +16,7 @@ module HTTPX
|
|
11
16
|
|
12
17
|
private
|
13
18
|
|
14
|
-
def initialize: (untyped body
|
19
|
+
def initialize: (untyped body) -> untyped
|
15
20
|
end
|
16
21
|
|
17
22
|
def self?.encode: (bodyIO body) -> Encoder
|
data/sig/transcoder/chunker.rbs
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
module HTTPX::Transcoder
|
2
2
|
module Chunker
|
3
|
-
|
3
|
+
CRLF: String
|
4
|
+
|
5
|
+
class Error < HTTPX::Error
|
6
|
+
end
|
7
|
+
|
8
|
+
def self?.encode: (_Each[String] chunks) -> Encoder
|
4
9
|
|
5
10
|
class Encoder
|
6
11
|
@raw: _Each[String]
|
@@ -9,10 +14,11 @@ module HTTPX::Transcoder
|
|
9
14
|
|
10
15
|
private
|
11
16
|
|
12
|
-
def initialize: (
|
17
|
+
def initialize: (_Each[String] chunks) -> untyped
|
13
18
|
end
|
14
19
|
|
15
20
|
class Decoder
|
21
|
+
extend Forwardable
|
16
22
|
include _ToS
|
17
23
|
include _Each[String]
|
18
24
|
|
data/sig/transcoder/form.rbs
CHANGED
@@ -3,12 +3,13 @@ module HTTPX::Transcoder
|
|
3
3
|
|
4
4
|
type form_nested_value = form_value | _ToAry[form_value] | _ToHash[string, form_value]
|
5
5
|
|
6
|
-
type urlencoded_input = Enumerable[[
|
6
|
+
type urlencoded_input = Enumerable[[_ToS, form_nested_value]]
|
7
7
|
|
8
8
|
module Form
|
9
9
|
def self?.encode: (urlencoded_input form) -> Encoder
|
10
10
|
|
11
11
|
class Encoder
|
12
|
+
extend Forwardable
|
12
13
|
include _Encoder
|
13
14
|
include _ToS
|
14
15
|
|
data/sig/transcoder/json.rbs
CHANGED