httpx 0.13.2 → 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/doc/release_notes/0_10_1.md +1 -1
- data/doc/release_notes/0_13_0.md +2 -2
- data/doc/release_notes/0_13_1.md +1 -1
- data/doc/release_notes/0_14_0.md +79 -0
- data/lib/httpx.rb +1 -2
- data/lib/httpx/callbacks.rb +12 -3
- data/lib/httpx/connection.rb +12 -9
- data/lib/httpx/connection/http1.rb +26 -11
- data/lib/httpx/connection/http2.rb +52 -8
- data/lib/httpx/headers.rb +1 -1
- data/lib/httpx/io/tcp.rb +1 -1
- data/lib/httpx/options.rb +91 -56
- data/lib/httpx/plugins/aws_sdk_authentication.rb +5 -2
- data/lib/httpx/plugins/aws_sigv4.rb +4 -4
- data/lib/httpx/plugins/basic_authentication.rb +8 -3
- data/lib/httpx/plugins/compression.rb +8 -8
- data/lib/httpx/plugins/compression/brotli.rb +4 -3
- data/lib/httpx/plugins/compression/deflate.rb +4 -3
- data/lib/httpx/plugins/compression/gzip.rb +2 -1
- data/lib/httpx/plugins/cookies.rb +3 -7
- data/lib/httpx/plugins/digest_authentication.rb +4 -4
- data/lib/httpx/plugins/expect.rb +6 -6
- data/lib/httpx/plugins/follow_redirects.rb +3 -3
- 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/multipart/part.rb +1 -1
- data/lib/httpx/plugins/proxy.rb +3 -7
- data/lib/httpx/plugins/proxy/ssh.rb +3 -3
- data/lib/httpx/plugins/rate_limiter.rb +1 -1
- data/lib/httpx/plugins/retries.rb +13 -14
- data/lib/httpx/plugins/stream.rb +96 -74
- data/lib/httpx/plugins/upgrade.rb +4 -4
- data/lib/httpx/request.rb +25 -2
- data/lib/httpx/response.rb +4 -0
- 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/connection/http1.rbs +4 -0
- data/sig/connection/http2.rbs +5 -1
- data/sig/options.rbs +9 -2
- data/sig/plugins/aws_sdk_authentication.rbs +2 -0
- data/sig/plugins/basic_authentication.rbs +2 -0
- data/sig/plugins/compression.rbs +2 -2
- data/sig/plugins/stream.rbs +17 -16
- data/sig/request.rbs +7 -2
- data/sig/response.rbs +1 -0
- data/sig/session.rbs +4 -0
- metadata +38 -35
- data/lib/httpx/timeout.rb +0 -67
- data/sig/timeout.rbs +0 -29
data/sig/options.rbs
CHANGED
@@ -5,16 +5,23 @@ 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
21
|
|
15
22
|
# timeout
|
16
|
-
attr_reader timeout:
|
17
|
-
def timeout=: (
|
23
|
+
attr_reader timeout: timeout
|
24
|
+
def timeout=: (timeout) -> void
|
18
25
|
|
19
26
|
# max_concurrent_requests
|
20
27
|
attr_reader max_concurrent_requests: Integer?
|
data/sig/plugins/compression.rbs
CHANGED
@@ -6,8 +6,8 @@ module HTTPX
|
|
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
|
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
|
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
data/sig/session.rbs
CHANGED
@@ -45,5 +45,9 @@ module HTTPX
|
|
45
45
|
def build_connection: (URI, Options) -> Connection
|
46
46
|
|
47
47
|
def send_requests: (*Request, options) -> Array[response]
|
48
|
+
|
49
|
+
def _send_requests: (Array[Request], options) -> Array[Connection]
|
50
|
+
|
51
|
+
def receive_requests: (Array[Request], Array[Connection], options) -> Array[response]
|
48
52
|
end
|
49
53
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: httpx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tiago Cardoso
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-05-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http-2-next
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.1
|
19
|
+
version: 0.4.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.1
|
26
|
+
version: 0.4.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: timers
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -47,43 +47,44 @@ extra_rdoc_files:
|
|
47
47
|
- LICENSE.txt
|
48
48
|
- README.md
|
49
49
|
- doc/release_notes/0_0_1.md
|
50
|
-
- doc/release_notes/
|
51
|
-
- doc/release_notes/0_0_3.md
|
52
|
-
- doc/release_notes/0_0_4.md
|
50
|
+
- doc/release_notes/0_1_0.md
|
53
51
|
- doc/release_notes/0_0_5.md
|
54
|
-
- doc/release_notes/
|
55
|
-
- doc/release_notes/
|
56
|
-
- doc/release_notes/
|
57
|
-
- doc/release_notes/
|
58
|
-
- doc/release_notes/
|
52
|
+
- doc/release_notes/0_0_4.md
|
53
|
+
- doc/release_notes/0_14_0.md
|
54
|
+
- doc/release_notes/0_6_5.md
|
55
|
+
- doc/release_notes/0_13_0.md
|
56
|
+
- doc/release_notes/0_6_1.md
|
59
57
|
- doc/release_notes/0_11_2.md
|
58
|
+
- doc/release_notes/0_7_0.md
|
59
|
+
- doc/release_notes/0_6_0.md
|
60
|
+
- doc/release_notes/0_10_2.md
|
60
61
|
- doc/release_notes/0_11_3.md
|
61
|
-
- doc/release_notes/
|
62
|
-
- doc/release_notes/
|
62
|
+
- doc/release_notes/0_8_2.md
|
63
|
+
- doc/release_notes/0_6_4.md
|
63
64
|
- doc/release_notes/0_13_1.md
|
65
|
+
- doc/release_notes/0_12_0.md
|
66
|
+
- doc/release_notes/0_9_0.md
|
67
|
+
- doc/release_notes/0_6_3.md
|
68
|
+
- doc/release_notes/0_10_1.md
|
69
|
+
- doc/release_notes/0_11_0.md
|
70
|
+
- doc/release_notes/0_8_1.md
|
71
|
+
- doc/release_notes/0_5_0.md
|
72
|
+
- doc/release_notes/0_6_7.md
|
64
73
|
- doc/release_notes/0_13_2.md
|
65
|
-
- doc/release_notes/0_1_0.md
|
66
|
-
- doc/release_notes/0_2_0.md
|
67
|
-
- doc/release_notes/0_2_1.md
|
68
|
-
- doc/release_notes/0_3_0.md
|
69
|
-
- doc/release_notes/0_3_1.md
|
70
|
-
- doc/release_notes/0_4_0.md
|
71
74
|
- doc/release_notes/0_4_1.md
|
72
|
-
- doc/release_notes/0_5_0.md
|
73
75
|
- doc/release_notes/0_5_1.md
|
74
|
-
- doc/release_notes/0_6_0.md
|
75
|
-
- doc/release_notes/0_6_1.md
|
76
|
-
- doc/release_notes/0_6_2.md
|
77
|
-
- doc/release_notes/0_6_3.md
|
78
|
-
- doc/release_notes/0_6_4.md
|
79
|
-
- doc/release_notes/0_6_5.md
|
80
76
|
- doc/release_notes/0_6_6.md
|
81
|
-
- doc/release_notes/
|
82
|
-
- doc/release_notes/
|
77
|
+
- doc/release_notes/0_4_0.md
|
78
|
+
- doc/release_notes/0_6_2.md
|
79
|
+
- doc/release_notes/0_10_0.md
|
80
|
+
- doc/release_notes/0_11_1.md
|
83
81
|
- doc/release_notes/0_8_0.md
|
84
|
-
- doc/release_notes/
|
85
|
-
- doc/release_notes/
|
86
|
-
- doc/release_notes/
|
82
|
+
- doc/release_notes/0_3_0.md
|
83
|
+
- doc/release_notes/0_2_1.md
|
84
|
+
- doc/release_notes/0_0_3.md
|
85
|
+
- doc/release_notes/0_0_2.md
|
86
|
+
- doc/release_notes/0_3_1.md
|
87
|
+
- doc/release_notes/0_2_0.md
|
87
88
|
files:
|
88
89
|
- LICENSE.txt
|
89
90
|
- README.md
|
@@ -103,6 +104,7 @@ files:
|
|
103
104
|
- doc/release_notes/0_13_0.md
|
104
105
|
- doc/release_notes/0_13_1.md
|
105
106
|
- doc/release_notes/0_13_2.md
|
107
|
+
- doc/release_notes/0_14_0.md
|
106
108
|
- doc/release_notes/0_1_0.md
|
107
109
|
- doc/release_notes/0_2_0.md
|
108
110
|
- doc/release_notes/0_2_1.md
|
@@ -167,6 +169,9 @@ files:
|
|
167
169
|
- lib/httpx/plugins/digest_authentication.rb
|
168
170
|
- lib/httpx/plugins/expect.rb
|
169
171
|
- lib/httpx/plugins/follow_redirects.rb
|
172
|
+
- lib/httpx/plugins/grpc.rb
|
173
|
+
- lib/httpx/plugins/grpc/call.rb
|
174
|
+
- lib/httpx/plugins/grpc/message.rb
|
170
175
|
- lib/httpx/plugins/h2c.rb
|
171
176
|
- lib/httpx/plugins/internal_telemetry.rb
|
172
177
|
- lib/httpx/plugins/multipart.rb
|
@@ -196,7 +201,6 @@ files:
|
|
196
201
|
- lib/httpx/response.rb
|
197
202
|
- lib/httpx/selector.rb
|
198
203
|
- lib/httpx/session.rb
|
199
|
-
- lib/httpx/timeout.rb
|
200
204
|
- lib/httpx/transcoder.rb
|
201
205
|
- lib/httpx/transcoder/body.rb
|
202
206
|
- lib/httpx/transcoder/chunker.rb
|
@@ -255,7 +259,6 @@ files:
|
|
255
259
|
- sig/response.rbs
|
256
260
|
- sig/selector.rbs
|
257
261
|
- sig/session.rbs
|
258
|
-
- sig/timeout.rbs
|
259
262
|
- sig/transcoder.rbs
|
260
263
|
- sig/transcoder/body.rbs
|
261
264
|
- sig/transcoder/chunker.rbs
|
@@ -284,7 +287,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
284
287
|
- !ruby/object:Gem::Version
|
285
288
|
version: '0'
|
286
289
|
requirements: []
|
287
|
-
rubygems_version: 3.
|
290
|
+
rubygems_version: 3.1.6
|
288
291
|
signing_key:
|
289
292
|
specification_version: 4
|
290
293
|
summary: HTTPX, to the future, and beyond
|
data/lib/httpx/timeout.rb
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "timeout"
|
4
|
-
|
5
|
-
module HTTPX
|
6
|
-
class Timeout
|
7
|
-
CONNECT_TIMEOUT = 60
|
8
|
-
OPERATION_TIMEOUT = 60
|
9
|
-
KEEP_ALIVE_TIMEOUT = 20
|
10
|
-
|
11
|
-
def self.new(opts = {})
|
12
|
-
return opts if opts.is_a?(Timeout)
|
13
|
-
|
14
|
-
super(**opts)
|
15
|
-
end
|
16
|
-
|
17
|
-
attr_reader :connect_timeout, :operation_timeout, :keep_alive_timeout, :total_timeout
|
18
|
-
|
19
|
-
def initialize(connect_timeout: CONNECT_TIMEOUT,
|
20
|
-
operation_timeout: OPERATION_TIMEOUT,
|
21
|
-
keep_alive_timeout: KEEP_ALIVE_TIMEOUT,
|
22
|
-
total_timeout: nil,
|
23
|
-
loop_timeout: nil)
|
24
|
-
@connect_timeout = connect_timeout
|
25
|
-
@operation_timeout = operation_timeout
|
26
|
-
@keep_alive_timeout = keep_alive_timeout
|
27
|
-
@total_timeout = total_timeout
|
28
|
-
|
29
|
-
return unless loop_timeout
|
30
|
-
|
31
|
-
# :nocov:
|
32
|
-
warn ":loop_timeout is deprecated, use :operation_timeout instead"
|
33
|
-
@operation_timeout = loop_timeout
|
34
|
-
# :nocov:
|
35
|
-
end
|
36
|
-
|
37
|
-
def ==(other)
|
38
|
-
if other.is_a?(Timeout)
|
39
|
-
@connect_timeout == other.instance_variable_get(:@connect_timeout) &&
|
40
|
-
@operation_timeout == other.instance_variable_get(:@operation_timeout) &&
|
41
|
-
@keep_alive_timeout == other.instance_variable_get(:@keep_alive_timeout) &&
|
42
|
-
@total_timeout == other.instance_variable_get(:@total_timeout)
|
43
|
-
else
|
44
|
-
super
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
def merge(other)
|
49
|
-
case other
|
50
|
-
when Hash
|
51
|
-
timeout = Timeout.new(other)
|
52
|
-
merge(timeout)
|
53
|
-
when Timeout
|
54
|
-
connect_timeout = other.instance_variable_get(:@connect_timeout) || @connect_timeout
|
55
|
-
operation_timeout = other.instance_variable_get(:@operation_timeout) || @operation_timeout
|
56
|
-
keep_alive_timeout = other.instance_variable_get(:@keep_alive_timeout) || @keep_alive_timeout
|
57
|
-
total_timeout = other.instance_variable_get(:@total_timeout) || @total_timeout
|
58
|
-
Timeout.new(connect_timeout: connect_timeout,
|
59
|
-
operation_timeout: operation_timeout,
|
60
|
-
keep_alive_timeout: keep_alive_timeout,
|
61
|
-
total_timeout: total_timeout)
|
62
|
-
else
|
63
|
-
raise ArgumentError, "can't merge with #{other.class}"
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
data/sig/timeout.rbs
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
module HTTPX
|
2
|
-
class Timeout
|
3
|
-
CONNECT_TIMEOUT: Numeric
|
4
|
-
KEEP_ALIVE_TIMEOUT: Numeric
|
5
|
-
OPERATION_TIMEOUT: Numeric
|
6
|
-
|
7
|
-
attr_reader connect_timeout: Numeric
|
8
|
-
attr_reader operation_timeout: Numeric
|
9
|
-
attr_reader total_timeout: Numeric?
|
10
|
-
attr_reader keep_alive_timeout: Numeric?
|
11
|
-
|
12
|
-
def self.new: (instance | Hash[Symbol, untyped]) -> instance
|
13
|
-
| () -> instance
|
14
|
-
|
15
|
-
def ==: (untyped other) -> bool
|
16
|
-
|
17
|
-
def merge: (Timeout | Hash[Symbol, untyped]) -> instance
|
18
|
-
|
19
|
-
private
|
20
|
-
|
21
|
-
def initialize: (
|
22
|
-
?connect_timeout: Numeric,
|
23
|
-
?operation_timeout: Numeric,
|
24
|
-
?keep_alive_timeout: Numeric,
|
25
|
-
?total_timeout: Numeric | nil,
|
26
|
-
?loop_timeout: Numeric | nil
|
27
|
-
) -> untyped
|
28
|
-
end
|
29
|
-
end
|