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.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/doc/release_notes/0_10_1.md +1 -1
  3. data/doc/release_notes/0_13_0.md +58 -0
  4. data/doc/release_notes/0_13_1.md +5 -0
  5. data/doc/release_notes/0_13_2.md +9 -0
  6. data/doc/release_notes/0_14_0.md +79 -0
  7. data/doc/release_notes/0_14_1.md +7 -0
  8. data/lib/httpx.rb +1 -2
  9. data/lib/httpx/callbacks.rb +12 -3
  10. data/lib/httpx/chainable.rb +2 -2
  11. data/lib/httpx/connection.rb +29 -22
  12. data/lib/httpx/connection/http1.rb +35 -15
  13. data/lib/httpx/connection/http2.rb +61 -15
  14. data/lib/httpx/headers.rb +7 -3
  15. data/lib/httpx/io/ssl.rb +30 -17
  16. data/lib/httpx/io/tcp.rb +48 -27
  17. data/lib/httpx/io/udp.rb +31 -7
  18. data/lib/httpx/io/unix.rb +27 -12
  19. data/lib/httpx/options.rb +97 -74
  20. data/lib/httpx/plugins/aws_sdk_authentication.rb +5 -2
  21. data/lib/httpx/plugins/aws_sigv4.rb +5 -4
  22. data/lib/httpx/plugins/basic_authentication.rb +8 -3
  23. data/lib/httpx/plugins/compression.rb +24 -12
  24. data/lib/httpx/plugins/compression/brotli.rb +10 -7
  25. data/lib/httpx/plugins/compression/deflate.rb +6 -5
  26. data/lib/httpx/plugins/compression/gzip.rb +4 -3
  27. data/lib/httpx/plugins/cookies.rb +3 -7
  28. data/lib/httpx/plugins/digest_authentication.rb +5 -5
  29. data/lib/httpx/plugins/expect.rb +6 -6
  30. data/lib/httpx/plugins/follow_redirects.rb +4 -4
  31. data/lib/httpx/plugins/grpc.rb +247 -0
  32. data/lib/httpx/plugins/grpc/call.rb +62 -0
  33. data/lib/httpx/plugins/grpc/message.rb +85 -0
  34. data/lib/httpx/plugins/h2c.rb +43 -58
  35. data/lib/httpx/plugins/internal_telemetry.rb +1 -1
  36. data/lib/httpx/plugins/multipart/part.rb +2 -2
  37. data/lib/httpx/plugins/proxy.rb +3 -7
  38. data/lib/httpx/plugins/proxy/http.rb +5 -4
  39. data/lib/httpx/plugins/proxy/ssh.rb +3 -3
  40. data/lib/httpx/plugins/rate_limiter.rb +1 -1
  41. data/lib/httpx/plugins/retries.rb +14 -15
  42. data/lib/httpx/plugins/stream.rb +99 -75
  43. data/lib/httpx/plugins/upgrade.rb +84 -0
  44. data/lib/httpx/plugins/upgrade/h2.rb +54 -0
  45. data/lib/httpx/pool.rb +14 -5
  46. data/lib/httpx/request.rb +25 -2
  47. data/lib/httpx/resolver/native.rb +7 -3
  48. data/lib/httpx/response.rb +9 -5
  49. data/lib/httpx/session.rb +17 -7
  50. data/lib/httpx/transcoder/chunker.rb +1 -1
  51. data/lib/httpx/version.rb +1 -1
  52. data/sig/callbacks.rbs +2 -0
  53. data/sig/chainable.rbs +2 -1
  54. data/sig/connection/http1.rbs +6 -1
  55. data/sig/connection/http2.rbs +6 -2
  56. data/sig/headers.rbs +2 -2
  57. data/sig/options.rbs +16 -22
  58. data/sig/plugins/aws_sdk_authentication.rbs +2 -0
  59. data/sig/plugins/aws_sigv4.rbs +0 -1
  60. data/sig/plugins/basic_authentication.rbs +2 -0
  61. data/sig/plugins/compression.rbs +7 -5
  62. data/sig/plugins/compression/brotli.rbs +1 -1
  63. data/sig/plugins/compression/deflate.rbs +1 -1
  64. data/sig/plugins/compression/gzip.rbs +1 -1
  65. data/sig/plugins/cookies.rbs +0 -1
  66. data/sig/plugins/digest_authentication.rbs +0 -1
  67. data/sig/plugins/expect.rbs +0 -2
  68. data/sig/plugins/follow_redirects.rbs +0 -2
  69. data/sig/plugins/h2c.rbs +5 -10
  70. data/sig/plugins/persistent.rbs +0 -1
  71. data/sig/plugins/proxy.rbs +0 -1
  72. data/sig/plugins/retries.rbs +0 -4
  73. data/sig/plugins/stream.rbs +17 -16
  74. data/sig/plugins/upgrade.rbs +23 -0
  75. data/sig/request.rbs +7 -2
  76. data/sig/response.rbs +4 -1
  77. data/sig/session.rbs +4 -0
  78. metadata +21 -7
  79. data/lib/httpx/timeout.rb +0 -67
  80. data/sig/timeout.rbs +0 -29
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.12.0
4
+ version: 0.14.1
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-02-22 00:00:00.000000000 Z
11
+ date: 2021-05-27 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.2
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.2
26
+ version: 0.4.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: timers
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -59,6 +59,11 @@ extra_rdoc_files:
59
59
  - doc/release_notes/0_11_2.md
60
60
  - doc/release_notes/0_11_3.md
61
61
  - doc/release_notes/0_12_0.md
62
+ - doc/release_notes/0_13_0.md
63
+ - doc/release_notes/0_13_1.md
64
+ - doc/release_notes/0_13_2.md
65
+ - doc/release_notes/0_14_0.md
66
+ - doc/release_notes/0_14_1.md
62
67
  - doc/release_notes/0_1_0.md
63
68
  - doc/release_notes/0_2_0.md
64
69
  - doc/release_notes/0_2_1.md
@@ -97,6 +102,11 @@ files:
97
102
  - doc/release_notes/0_11_2.md
98
103
  - doc/release_notes/0_11_3.md
99
104
  - doc/release_notes/0_12_0.md
105
+ - doc/release_notes/0_13_0.md
106
+ - doc/release_notes/0_13_1.md
107
+ - doc/release_notes/0_13_2.md
108
+ - doc/release_notes/0_14_0.md
109
+ - doc/release_notes/0_14_1.md
100
110
  - doc/release_notes/0_1_0.md
101
111
  - doc/release_notes/0_2_0.md
102
112
  - doc/release_notes/0_2_1.md
@@ -161,6 +171,9 @@ files:
161
171
  - lib/httpx/plugins/digest_authentication.rb
162
172
  - lib/httpx/plugins/expect.rb
163
173
  - lib/httpx/plugins/follow_redirects.rb
174
+ - lib/httpx/plugins/grpc.rb
175
+ - lib/httpx/plugins/grpc/call.rb
176
+ - lib/httpx/plugins/grpc/message.rb
164
177
  - lib/httpx/plugins/h2c.rb
165
178
  - lib/httpx/plugins/internal_telemetry.rb
166
179
  - lib/httpx/plugins/multipart.rb
@@ -177,6 +190,8 @@ files:
177
190
  - lib/httpx/plugins/rate_limiter.rb
178
191
  - lib/httpx/plugins/retries.rb
179
192
  - lib/httpx/plugins/stream.rb
193
+ - lib/httpx/plugins/upgrade.rb
194
+ - lib/httpx/plugins/upgrade/h2.rb
180
195
  - lib/httpx/pool.rb
181
196
  - lib/httpx/registry.rb
182
197
  - lib/httpx/request.rb
@@ -188,7 +203,6 @@ files:
188
203
  - lib/httpx/response.rb
189
204
  - lib/httpx/selector.rb
190
205
  - lib/httpx/session.rb
191
- - lib/httpx/timeout.rb
192
206
  - lib/httpx/transcoder.rb
193
207
  - lib/httpx/transcoder/body.rb
194
208
  - lib/httpx/transcoder/chunker.rb
@@ -235,6 +249,7 @@ files:
235
249
  - sig/plugins/rate_limiter.rbs
236
250
  - sig/plugins/retries.rbs
237
251
  - sig/plugins/stream.rbs
252
+ - sig/plugins/upgrade.rbs
238
253
  - sig/pool.rbs
239
254
  - sig/registry.rbs
240
255
  - sig/request.rbs
@@ -246,7 +261,6 @@ files:
246
261
  - sig/response.rbs
247
262
  - sig/selector.rbs
248
263
  - sig/session.rbs
249
- - sig/timeout.rbs
250
264
  - sig/transcoder.rbs
251
265
  - sig/transcoder/body.rbs
252
266
  - sig/transcoder/chunker.rbs
@@ -275,7 +289,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
275
289
  - !ruby/object:Gem::Version
276
290
  version: '0'
277
291
  requirements: []
278
- rubygems_version: 3.2.3
292
+ rubygems_version: 3.2.15
279
293
  signing_key:
280
294
  specification_version: 4
281
295
  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