httpx 0.12.0 → 0.14.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/0_10_1.md +1 -1
- data/doc/release_notes/0_13_0.md +58 -0
- data/doc/release_notes/0_13_1.md +5 -0
- data/doc/release_notes/0_13_2.md +9 -0
- data/doc/release_notes/0_14_0.md +79 -0
- data/doc/release_notes/0_14_1.md +7 -0
- data/lib/httpx.rb +1 -2
- data/lib/httpx/callbacks.rb +12 -3
- data/lib/httpx/chainable.rb +2 -2
- data/lib/httpx/connection.rb +29 -22
- data/lib/httpx/connection/http1.rb +35 -15
- data/lib/httpx/connection/http2.rb +61 -15
- data/lib/httpx/headers.rb +7 -3
- data/lib/httpx/io/ssl.rb +30 -17
- data/lib/httpx/io/tcp.rb +48 -27
- data/lib/httpx/io/udp.rb +31 -7
- data/lib/httpx/io/unix.rb +27 -12
- data/lib/httpx/options.rb +97 -74
- data/lib/httpx/plugins/aws_sdk_authentication.rb +5 -2
- data/lib/httpx/plugins/aws_sigv4.rb +5 -4
- data/lib/httpx/plugins/basic_authentication.rb +8 -3
- data/lib/httpx/plugins/compression.rb +24 -12
- data/lib/httpx/plugins/compression/brotli.rb +10 -7
- data/lib/httpx/plugins/compression/deflate.rb +6 -5
- data/lib/httpx/plugins/compression/gzip.rb +4 -3
- data/lib/httpx/plugins/cookies.rb +3 -7
- data/lib/httpx/plugins/digest_authentication.rb +5 -5
- data/lib/httpx/plugins/expect.rb +6 -6
- data/lib/httpx/plugins/follow_redirects.rb +4 -4
- data/lib/httpx/plugins/grpc.rb +247 -0
- data/lib/httpx/plugins/grpc/call.rb +62 -0
- data/lib/httpx/plugins/grpc/message.rb +85 -0
- data/lib/httpx/plugins/h2c.rb +43 -58
- data/lib/httpx/plugins/internal_telemetry.rb +1 -1
- data/lib/httpx/plugins/multipart/part.rb +2 -2
- data/lib/httpx/plugins/proxy.rb +3 -7
- data/lib/httpx/plugins/proxy/http.rb +5 -4
- data/lib/httpx/plugins/proxy/ssh.rb +3 -3
- data/lib/httpx/plugins/rate_limiter.rb +1 -1
- data/lib/httpx/plugins/retries.rb +14 -15
- data/lib/httpx/plugins/stream.rb +99 -75
- data/lib/httpx/plugins/upgrade.rb +84 -0
- data/lib/httpx/plugins/upgrade/h2.rb +54 -0
- data/lib/httpx/pool.rb +14 -5
- data/lib/httpx/request.rb +25 -2
- data/lib/httpx/resolver/native.rb +7 -3
- data/lib/httpx/response.rb +9 -5
- data/lib/httpx/session.rb +17 -7
- data/lib/httpx/transcoder/chunker.rb +1 -1
- data/lib/httpx/version.rb +1 -1
- data/sig/callbacks.rbs +2 -0
- data/sig/chainable.rbs +2 -1
- data/sig/connection/http1.rbs +6 -1
- data/sig/connection/http2.rbs +6 -2
- data/sig/headers.rbs +2 -2
- data/sig/options.rbs +16 -22
- data/sig/plugins/aws_sdk_authentication.rbs +2 -0
- data/sig/plugins/aws_sigv4.rbs +0 -1
- data/sig/plugins/basic_authentication.rbs +2 -0
- data/sig/plugins/compression.rbs +7 -5
- data/sig/plugins/compression/brotli.rbs +1 -1
- data/sig/plugins/compression/deflate.rbs +1 -1
- data/sig/plugins/compression/gzip.rbs +1 -1
- data/sig/plugins/cookies.rbs +0 -1
- data/sig/plugins/digest_authentication.rbs +0 -1
- data/sig/plugins/expect.rbs +0 -2
- data/sig/plugins/follow_redirects.rbs +0 -2
- data/sig/plugins/h2c.rbs +5 -10
- data/sig/plugins/persistent.rbs +0 -1
- data/sig/plugins/proxy.rbs +0 -1
- data/sig/plugins/retries.rbs +0 -4
- data/sig/plugins/stream.rbs +17 -16
- data/sig/plugins/upgrade.rbs +23 -0
- data/sig/request.rbs +7 -2
- data/sig/response.rbs +4 -1
- data/sig/session.rbs +4 -0
- metadata +21 -7
- data/lib/httpx/timeout.rb +0 -67
- data/sig/timeout.rbs +0 -29
data/sig/headers.rbs
CHANGED
@@ -14,8 +14,8 @@ module HTTPX
|
|
14
14
|
def add: (headers_key field, string value) -> void
|
15
15
|
def delete: (headers_key field) -> void
|
16
16
|
|
17
|
-
def each: () { (headers_key, String) -> void } -> void
|
18
|
-
| () -> Enumerable[[headers_key, String], void]
|
17
|
+
def each: (?_Each[headers_key, String]? extra_headers) { (headers_key, String) -> void } -> void
|
18
|
+
| (?_Each[headers_key, String]? extra_headers) -> Enumerable[[headers_key, String], void]
|
19
19
|
|
20
20
|
def get: (headers_key field) -> Array[String]
|
21
21
|
def key?: (headers_key downcased_key) -> bool
|
data/sig/options.rbs
CHANGED
@@ -5,68 +5,67 @@ module HTTPX
|
|
5
5
|
WINDOW_SIZE: Integer
|
6
6
|
MAX_BODY_THRESHOLD_SIZE: Integer
|
7
7
|
|
8
|
+
type timeout_type = :connect_timeout | :operation_timeout | :keep_alive_timeout | :total_timeout
|
9
|
+
type timeout = Hash[timeout_type, Numeric?]
|
10
|
+
|
8
11
|
def self.new: (options) -> instance
|
9
12
|
| () -> instance
|
10
13
|
|
14
|
+
# headers
|
15
|
+
attr_reader uri: URI?
|
16
|
+
def uri=: (uri) -> void
|
17
|
+
|
11
18
|
# headers
|
12
19
|
attr_reader headers: Headers?
|
13
20
|
def headers=: (headers) -> void
|
14
|
-
def with_headers: (headers) -> instance
|
15
21
|
|
16
22
|
# timeout
|
17
|
-
attr_reader timeout:
|
18
|
-
def timeout=: (
|
19
|
-
def with_timeout: (Hash[Symbol, untyped] | Timeout) -> instance
|
23
|
+
attr_reader timeout: timeout
|
24
|
+
def timeout=: (timeout) -> void
|
20
25
|
|
21
26
|
# max_concurrent_requests
|
22
27
|
attr_reader max_concurrent_requests: Integer?
|
23
28
|
def max_concurrent_requests=: (Integer) -> void
|
24
|
-
def with_max_concurrent_requests: (Integer) -> instance
|
25
29
|
|
26
30
|
# max_requests
|
27
31
|
attr_reader max_requests: Integer?
|
28
32
|
def max_requests=: (Integer) -> void
|
29
|
-
def with_max_requests: (Integer) -> instance
|
30
33
|
|
31
34
|
# window_size
|
32
35
|
attr_reader window_size: int?
|
33
36
|
def window_size=: (int) -> void
|
34
|
-
def with_window_size: (int) -> instance
|
35
37
|
|
36
38
|
# body_threshold_size
|
37
39
|
attr_reader body_threshold_size: int?
|
38
40
|
def body_threshold_size=: (int) -> void
|
39
|
-
def with_body_threshold_size: (int) -> instance
|
40
41
|
|
41
42
|
# transport
|
42
43
|
attr_reader transport: _ToS?
|
43
44
|
def transport=: (_ToS) -> void
|
44
|
-
def with_transport: (_ToS) -> instance
|
45
45
|
|
46
46
|
# transport_options
|
47
47
|
attr_reader transport_options: Hash[untyped, untyped]?
|
48
48
|
def transport_options=: (Hash[untyped, untyped]) -> void
|
49
|
-
|
49
|
+
|
50
|
+
# addresses
|
51
|
+
attr_reader addresses: _ToAry[untyped]?
|
52
|
+
def addresses=: (_ToAry[untyped]) -> void
|
50
53
|
|
51
54
|
# params
|
52
55
|
attr_reader params: Transcoder::urlencoded_input?
|
53
56
|
def params=: (Transcoder::urlencoded_input) -> void
|
54
|
-
def with_params: (Transcoder::urlencoded_input) -> instance
|
55
57
|
|
56
58
|
# form
|
57
59
|
attr_reader form: Transcoder::urlencoded_input?
|
58
60
|
def form=: (Transcoder::urlencoded_input) -> void
|
59
|
-
def with_form: (Transcoder::urlencoded_input) -> instance
|
60
61
|
|
61
62
|
# json
|
62
63
|
attr_reader json: _ToJson?
|
63
64
|
def json=: (_ToJson) -> void
|
64
|
-
def with_json: (_ToJson) -> instance
|
65
65
|
|
66
66
|
# body
|
67
67
|
attr_reader body: bodyIO?
|
68
68
|
def body=: (bodyIO) -> void
|
69
|
-
def with_body: (bodyIO) -> instance
|
70
69
|
|
71
70
|
# ssl
|
72
71
|
|
@@ -79,32 +78,27 @@ module HTTPX
|
|
79
78
|
# request_class
|
80
79
|
attr_reader request_class: singleton(Request)
|
81
80
|
def request_class=: (singleton(Request)) -> void
|
82
|
-
def with_request_class: (singleton(Request)) -> instance
|
83
81
|
|
84
82
|
# io
|
85
|
-
|
86
|
-
|
87
|
-
def
|
83
|
+
type io_option = _ToIO | Hash[String, _ToIO]
|
84
|
+
attr_reader io: io_option?
|
85
|
+
def io=: (io_option) -> void
|
88
86
|
|
89
87
|
# fallback_protocol
|
90
88
|
attr_reader fallback_protocol: String?
|
91
89
|
def fallback_protocol=: (String) -> void
|
92
|
-
def with_fallback_protocol: (String) -> instance
|
93
90
|
|
94
91
|
# debug
|
95
92
|
attr_reader debug: _IOLogger?
|
96
93
|
def debug=: (_IOLogger) -> void
|
97
|
-
def with_debug: (_IOLogger) -> instance
|
98
94
|
|
99
95
|
# debug_level
|
100
96
|
attr_reader debug_level: Integer?
|
101
97
|
def debug_level=: (Integer) -> void
|
102
|
-
def with_debug_level: (Integer) -> instance
|
103
98
|
|
104
99
|
# persistent
|
105
100
|
attr_reader persistent: bool?
|
106
101
|
def persistent=: (bool) -> void
|
107
|
-
def with_persistent: (bool) -> instance
|
108
102
|
|
109
103
|
def ==: (untyped other) -> bool
|
110
104
|
def merge: (_ToHash other) -> instance
|
data/sig/plugins/aws_sigv4.rbs
CHANGED
data/sig/plugins/compression.rbs
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
module HTTPX
|
2
2
|
module Plugins
|
3
3
|
module Compression
|
4
|
-
|
4
|
+
type encodings_registry = Registry[Symbol, Class]
|
5
5
|
|
6
6
|
type deflatable = _Reader | _ToS
|
7
7
|
|
8
8
|
interface _Deflater
|
9
|
-
def deflate: (deflatable, _Writer, chunk_size: Integer) ->
|
10
|
-
| (deflatable, _Writer, chunk_size: Integer) { (String) -> void } ->
|
9
|
+
def deflate: (deflatable, ?_Writer, ?chunk_size: Integer) -> _ToS
|
10
|
+
| (deflatable, ?_Writer, ?chunk_size: Integer) { (String) -> void } -> _ToS
|
11
11
|
end
|
12
12
|
|
13
13
|
interface _Inflater
|
@@ -16,12 +16,14 @@ module HTTPX
|
|
16
16
|
def initialize: (Numeric bytesize) -> untyped
|
17
17
|
end
|
18
18
|
|
19
|
-
def self.
|
19
|
+
def self.configure: (singleton(Session)) -> void
|
20
20
|
|
21
21
|
interface _CompressionOptions
|
22
22
|
def compression_threshold_size: () -> _Integer?
|
23
23
|
def compression_threshold_size=: (int) -> int
|
24
|
-
|
24
|
+
|
25
|
+
def encodings: () -> encodings_registry?
|
26
|
+
def encodings=: (encodings_registry) -> encodings_registry
|
25
27
|
end
|
26
28
|
|
27
29
|
def self.extra_options: (Options) -> (Options & _CompressionOptions)
|
@@ -3,7 +3,7 @@ module HTTPX
|
|
3
3
|
module Compression
|
4
4
|
module Brotli
|
5
5
|
def self.load_dependencies: (singleton(Session)) -> void
|
6
|
-
def self.configure: (
|
6
|
+
def self.configure: (singleton(Session)) -> void
|
7
7
|
|
8
8
|
def self?.deflater: () -> _Deflater
|
9
9
|
def self?.decoder: (Numeric bytesize) -> Inflater
|
@@ -3,7 +3,7 @@ module HTTPX
|
|
3
3
|
module Compression
|
4
4
|
module Deflate
|
5
5
|
def self.load_dependencies: (singleton(Session)) -> void
|
6
|
-
def self.configure: (
|
6
|
+
def self.configure: (singleton(Session)) -> void
|
7
7
|
|
8
8
|
def self?.deflater: () -> _Deflater
|
9
9
|
def self?.inflater: (Numeric bytesize) -> GZIP::Inflater
|
@@ -3,7 +3,7 @@ module HTTPX
|
|
3
3
|
module Compression
|
4
4
|
module GZIP
|
5
5
|
def self.load_dependencies: (singleton(Session)) -> void
|
6
|
-
def self.configure: (
|
6
|
+
def self.configure: (singleton(Session)) -> void
|
7
7
|
|
8
8
|
def self?.deflater: () -> _Deflater
|
9
9
|
def self?.inflater: (Numeric bytesize) -> Inflater
|
data/sig/plugins/cookies.rbs
CHANGED
data/sig/plugins/expect.rbs
CHANGED
@@ -6,11 +6,9 @@ module HTTPX
|
|
6
6
|
interface _ExpectOptions
|
7
7
|
def expect_timeout: () -> Integer?
|
8
8
|
def expect_timeout=: (int) -> Integer
|
9
|
-
def with_expect_timeout: (int) -> instance
|
10
9
|
|
11
10
|
def expect_threshold_size: () -> Integer?
|
12
11
|
def expect_threshold_size=: (int) -> Integer
|
13
|
-
def with_expect_threshold_size: (int) -> instance
|
14
12
|
end
|
15
13
|
|
16
14
|
def self.extra_options: (Options) -> (Options & _ExpectOptions)
|
@@ -9,11 +9,9 @@ module HTTPX
|
|
9
9
|
interface _FollowRedirectsOptions
|
10
10
|
def max_redirects: () -> Integer?
|
11
11
|
def max_redirects=: (int) -> Integer
|
12
|
-
def with_max_redirects: (int) -> instance
|
13
12
|
|
14
13
|
def follow_insecure_redirects: () -> bool?
|
15
14
|
def follow_insecure_redirects=: (bool) -> bool
|
16
|
-
def with_follow_insecure_redirects: (bool) -> instance
|
17
15
|
end
|
18
16
|
|
19
17
|
def self.extra_options: (Options) -> (Options & _FollowRedirectsOptions)
|
data/sig/plugins/h2c.rbs
CHANGED
@@ -1,23 +1,18 @@
|
|
1
1
|
module HTTPX
|
2
2
|
module Plugins
|
3
3
|
module H2C
|
4
|
-
|
5
|
-
|
6
|
-
module InstanceMethods
|
7
|
-
VALID_H2C_METHODS: Array[Symbol]
|
8
|
-
|
9
|
-
private
|
4
|
+
VALID_H2C_VERBS: Array[Symbol]
|
10
5
|
|
11
|
-
|
12
|
-
|
13
|
-
|
6
|
+
def self.load_dependencies: (*untyped) -> void
|
7
|
+
def self.configure: (singleton(Session)) -> void
|
8
|
+
def self.call: (Connection, Request, response) -> void
|
14
9
|
|
15
10
|
class H2CParser < Connection::HTTP2
|
16
11
|
def upgrade: (Request, Response) -> void
|
17
12
|
end
|
18
13
|
|
19
14
|
module ConnectionMethods
|
20
|
-
def
|
15
|
+
def upgrade_to_h2c: (Request, Response) -> void
|
21
16
|
end
|
22
17
|
end
|
23
18
|
|
data/sig/plugins/persistent.rbs
CHANGED
data/sig/plugins/proxy.rbs
CHANGED
data/sig/plugins/retries.rbs
CHANGED
@@ -12,19 +12,15 @@ module HTTPX
|
|
12
12
|
interface _RetriesOptions
|
13
13
|
def retry_after: () -> Numeric?
|
14
14
|
def retry_after=: (Numeric) -> Numeric
|
15
|
-
def with_retry_after: (Numeric) -> instance
|
16
15
|
|
17
16
|
def max_retries: () -> Integer?
|
18
17
|
def max_retries=: (int) -> Integer
|
19
|
-
def with_max_retries: (int) -> instance
|
20
18
|
|
21
19
|
def retry_change_requests: () -> bool?
|
22
20
|
def retry_change_requests=: (bool) -> bool
|
23
|
-
def with_retry_change_requests: (bool) -> instance
|
24
21
|
|
25
22
|
def retry_on: () -> _RetryCallback?
|
26
23
|
def retry_on=: (_RetryCallback) -> _RetryCallback
|
27
|
-
def with_retry_on: (_RetryCallback) -> instance
|
28
24
|
end
|
29
25
|
|
30
26
|
def self.extra_options: (Options) -> (Options & _RetriesOptions)
|
data/sig/plugins/stream.rbs
CHANGED
@@ -1,4 +1,21 @@
|
|
1
1
|
module HTTPX
|
2
|
+
class StreamResponse
|
3
|
+
include _ToS
|
4
|
+
|
5
|
+
def each: () { (String) -> void } -> void
|
6
|
+
| () -> Enumerable[String]
|
7
|
+
|
8
|
+
def each_line: () { (String) -> void } -> void
|
9
|
+
| () -> Enumerable[String]
|
10
|
+
|
11
|
+
def on_chunk: (string) -> void
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def response: () -> response
|
16
|
+
def initialize: (Request, Session, Array[Connection]) -> untyped
|
17
|
+
end
|
18
|
+
|
2
19
|
module Plugins
|
3
20
|
module Stream
|
4
21
|
module InstanceMethods
|
@@ -16,22 +33,6 @@ module HTTPX
|
|
16
33
|
def stream: () -> StreamResponse?
|
17
34
|
end
|
18
35
|
|
19
|
-
class StreamResponse
|
20
|
-
include _ToS
|
21
|
-
|
22
|
-
def each: () { (String) -> void } -> void
|
23
|
-
| () -> Enumerable[String]
|
24
|
-
|
25
|
-
def each_line: () { (String) -> void } -> void
|
26
|
-
| () -> Enumerable[String]
|
27
|
-
|
28
|
-
def on_chunk: (string) -> void
|
29
|
-
|
30
|
-
private
|
31
|
-
|
32
|
-
def response: () -> response
|
33
|
-
def initialize: (Request, Session) -> untyped
|
34
|
-
end
|
35
36
|
end
|
36
37
|
|
37
38
|
type sessionStream = Session & Plugins::Stream::InstanceMethods
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module HTTPX
|
2
|
+
module Plugins
|
3
|
+
module Upgrade
|
4
|
+
type handlers_registry = Registry[Symbol, Class]
|
5
|
+
|
6
|
+
def self.configure: (singleton(Session)) -> void
|
7
|
+
|
8
|
+
interface _UpgradeOptions
|
9
|
+
def upgrade_handlers: () -> handlers_registry?
|
10
|
+
def upgrade_handlers=: (handlers_registry) -> handlers_registry
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.extra_options: (Options) -> (Options & _UpgradeOptions)
|
14
|
+
|
15
|
+
module ConnectionMethods
|
16
|
+
attr_reader upgrade_protocol: Symbol?
|
17
|
+
attr_reader hijacked: boolish
|
18
|
+
|
19
|
+
def hijack_io: () -> void
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/sig/request.rbs
CHANGED
@@ -11,7 +11,8 @@ module HTTPX
|
|
11
11
|
attr_reader body: Body
|
12
12
|
attr_reader state: Symbol
|
13
13
|
attr_reader options: Options
|
14
|
-
attr_reader response:
|
14
|
+
attr_reader response: response?
|
15
|
+
attr_reader drain_error: StandardError?
|
15
16
|
|
16
17
|
def initialize: (verb | String, uri, ?options?) -> untyped
|
17
18
|
|
@@ -21,7 +22,7 @@ module HTTPX
|
|
21
22
|
|
22
23
|
def scheme: () -> ("http" | "https")
|
23
24
|
|
24
|
-
def response=: (
|
25
|
+
def response=: (response) -> void
|
25
26
|
|
26
27
|
def path: () -> String
|
27
28
|
|
@@ -39,6 +40,10 @@ module HTTPX
|
|
39
40
|
|
40
41
|
def expects?: () -> boolish
|
41
42
|
|
43
|
+
def trailers: () -> Headers
|
44
|
+
|
45
|
+
def trailers?: () -> boolish
|
46
|
+
|
42
47
|
class Body
|
43
48
|
def initialize: (Headers, Options) -> untyped
|
44
49
|
def each: () { (String) -> void } -> void
|
data/sig/response.rbs
CHANGED
@@ -37,6 +37,8 @@ module HTTPX
|
|
37
37
|
include _ToStr
|
38
38
|
|
39
39
|
@state: :idle | :memory | :buffer
|
40
|
+
@threshold_size: Integer
|
41
|
+
@window_size: Integer
|
40
42
|
|
41
43
|
def each: () { (String) -> void } -> void
|
42
44
|
| () -> Enumerable[String]
|
@@ -45,10 +47,11 @@ module HTTPX
|
|
45
47
|
def empty?: () -> bool
|
46
48
|
def copy_to: (_ToPath | _Writer destination) -> void
|
47
49
|
def close: () -> void
|
50
|
+
def closed?: () -> bool
|
48
51
|
|
49
52
|
private
|
50
53
|
|
51
|
-
def initialize: (Response,
|
54
|
+
def initialize: (Response, options) -> untyped
|
52
55
|
def rewind: () -> void
|
53
56
|
def transition: () -> void
|
54
57
|
end
|