httpx 0.22.4 → 0.23.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.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/doc/release_notes/0_22_5.md +6 -0
  3. data/doc/release_notes/0_23_0.md +42 -0
  4. data/lib/httpx/adapters/datadog.rb +12 -2
  5. data/lib/httpx/adapters/faraday.rb +1 -1
  6. data/lib/httpx/adapters/sentry.rb +15 -5
  7. data/lib/httpx/adapters/webmock.rb +2 -2
  8. data/lib/httpx/buffer.rb +4 -0
  9. data/lib/httpx/callbacks.rb +3 -3
  10. data/lib/httpx/chainable.rb +4 -4
  11. data/lib/httpx/connection/http1.rb +2 -2
  12. data/lib/httpx/connection/http2.rb +2 -3
  13. data/lib/httpx/connection.rb +31 -11
  14. data/lib/httpx/io/udp.rb +2 -0
  15. data/lib/httpx/io/unix.rb +1 -5
  16. data/lib/httpx/io.rb +0 -10
  17. data/lib/httpx/options.rb +16 -2
  18. data/lib/httpx/plugins/authentication/digest.rb +1 -1
  19. data/lib/httpx/plugins/aws_sdk_authentication.rb +1 -3
  20. data/lib/httpx/plugins/aws_sigv4.rb +1 -1
  21. data/lib/httpx/plugins/compression/brotli.rb +4 -4
  22. data/lib/httpx/plugins/compression/deflate.rb +12 -7
  23. data/lib/httpx/plugins/compression/gzip.rb +7 -5
  24. data/lib/httpx/plugins/compression.rb +9 -8
  25. data/lib/httpx/plugins/digest_authentication.rb +1 -4
  26. data/lib/httpx/plugins/follow_redirects.rb +1 -1
  27. data/lib/httpx/plugins/grpc/message.rb +3 -1
  28. data/lib/httpx/plugins/grpc.rb +3 -3
  29. data/lib/httpx/plugins/h2c.rb +5 -9
  30. data/lib/httpx/plugins/internal_telemetry.rb +16 -0
  31. data/lib/httpx/plugins/multipart.rb +14 -2
  32. data/lib/httpx/plugins/proxy/http.rb +4 -4
  33. data/lib/httpx/plugins/proxy.rb +65 -31
  34. data/lib/httpx/plugins/response_cache.rb +2 -2
  35. data/lib/httpx/plugins/retries.rb +49 -2
  36. data/lib/httpx/plugins/upgrade/h2.rb +3 -3
  37. data/lib/httpx/plugins/upgrade.rb +4 -7
  38. data/lib/httpx/plugins/webdav.rb +7 -7
  39. data/lib/httpx/pool.rb +7 -3
  40. data/lib/httpx/request.rb +23 -13
  41. data/lib/httpx/resolver/https.rb +37 -20
  42. data/lib/httpx/resolver/multi.rb +1 -6
  43. data/lib/httpx/resolver/native.rb +128 -36
  44. data/lib/httpx/resolver.rb +26 -14
  45. data/lib/httpx/response.rb +14 -16
  46. data/lib/httpx/session.rb +1 -0
  47. data/lib/httpx/transcoder/body.rb +0 -1
  48. data/lib/httpx/transcoder/chunker.rb +0 -1
  49. data/lib/httpx/transcoder/form.rb +0 -1
  50. data/lib/httpx/transcoder/json.rb +0 -1
  51. data/lib/httpx/transcoder/xml.rb +0 -1
  52. data/lib/httpx/transcoder.rb +0 -2
  53. data/lib/httpx/version.rb +1 -1
  54. data/lib/httpx.rb +0 -1
  55. data/sig/buffer.rbs +1 -0
  56. data/sig/chainable.rbs +3 -3
  57. data/sig/connection.rbs +17 -6
  58. data/sig/errors.rbs +9 -0
  59. data/sig/httpx.rbs +3 -3
  60. data/sig/io/ssl.rbs +17 -0
  61. data/sig/io/tcp.rbs +57 -0
  62. data/sig/io/udp.rbs +20 -0
  63. data/sig/io/unix.rbs +10 -0
  64. data/sig/options.rbs +5 -1
  65. data/sig/plugins/compression.rbs +6 -2
  66. data/sig/plugins/cookies/jar.rbs +2 -2
  67. data/sig/plugins/grpc.rbs +3 -3
  68. data/sig/plugins/h2c.rbs +1 -1
  69. data/sig/plugins/proxy.rbs +1 -5
  70. data/sig/plugins/response_cache.rbs +1 -1
  71. data/sig/plugins/retries.rbs +28 -8
  72. data/sig/plugins/upgrade.rbs +5 -3
  73. data/sig/request.rbs +6 -2
  74. data/sig/resolver/https.rbs +3 -1
  75. data/sig/resolver/native.rbs +7 -2
  76. data/sig/resolver/resolver.rbs +0 -2
  77. data/sig/resolver/system.rbs +2 -0
  78. data/sig/resolver.rbs +8 -4
  79. data/sig/response.rbs +6 -2
  80. data/sig/session.rbs +10 -10
  81. data/sig/transcoder/xml.rbs +1 -1
  82. data/sig/transcoder.rbs +4 -5
  83. metadata +11 -5
  84. data/lib/httpx/registry.rb +0 -85
  85. data/sig/registry.rbs +0 -13
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.22.4
4
+ version: 0.23.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: 2023-02-08 00:00:00.000000000 Z
11
+ date: 2023-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http-2-next
@@ -93,6 +93,8 @@ extra_rdoc_files:
93
93
  - doc/release_notes/0_22_2.md
94
94
  - doc/release_notes/0_22_3.md
95
95
  - doc/release_notes/0_22_4.md
96
+ - doc/release_notes/0_22_5.md
97
+ - doc/release_notes/0_23_0.md
96
98
  - doc/release_notes/0_2_0.md
97
99
  - doc/release_notes/0_2_1.md
98
100
  - doc/release_notes/0_3_0.md
@@ -178,6 +180,8 @@ files:
178
180
  - doc/release_notes/0_22_2.md
179
181
  - doc/release_notes/0_22_3.md
180
182
  - doc/release_notes/0_22_4.md
183
+ - doc/release_notes/0_22_5.md
184
+ - doc/release_notes/0_23_0.md
181
185
  - doc/release_notes/0_2_0.md
182
186
  - doc/release_notes/0_2_1.md
183
187
  - doc/release_notes/0_3_0.md
@@ -274,7 +278,6 @@ files:
274
278
  - lib/httpx/pmatch_extensions.rb
275
279
  - lib/httpx/pool.rb
276
280
  - lib/httpx/punycode.rb
277
- - lib/httpx/registry.rb
278
281
  - lib/httpx/request.rb
279
282
  - lib/httpx/resolver.rb
280
283
  - lib/httpx/resolver/https.rb
@@ -307,6 +310,10 @@ files:
307
310
  - sig/headers.rbs
308
311
  - sig/httpx.rbs
309
312
  - sig/io.rbs
313
+ - sig/io/ssl.rbs
314
+ - sig/io/tcp.rbs
315
+ - sig/io/udp.rbs
316
+ - sig/io/unix.rbs
310
317
  - sig/loggable.rbs
311
318
  - sig/options.rbs
312
319
  - sig/parser/http1.rbs
@@ -346,7 +353,6 @@ files:
346
353
  - sig/plugins/stream.rbs
347
354
  - sig/plugins/upgrade.rbs
348
355
  - sig/pool.rbs
349
- - sig/registry.rbs
350
356
  - sig/request.rbs
351
357
  - sig/resolver.rbs
352
358
  - sig/resolver/https.rbs
@@ -390,7 +396,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
390
396
  - !ruby/object:Gem::Version
391
397
  version: '0'
392
398
  requirements: []
393
- rubygems_version: 3.4.1
399
+ rubygems_version: 3.4.6
394
400
  signing_key:
395
401
  specification_version: 4
396
402
  summary: HTTPX, to the future, and beyond
@@ -1,85 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module HTTPX
4
- # Adds a general-purpose registry API to a class. It is designed to be a
5
- # configuration-level API, i.e. the registry is global to the class and
6
- # should be set on **boot time**.
7
- #
8
- # It is used internally to associate tags with handlers.
9
- #
10
- # ## Register/Fetch
11
- #
12
- # One is strongly advised to register handlers when creating the class.
13
- #
14
- # There is an instance-level method to retrieve from the registry based
15
- # on the tag:
16
- #
17
- # class Server
18
- # include HTTPX::Registry
19
- #
20
- # register "tcp", TCPHandler
21
- # register "ssl", SSLHandlers
22
- # ...
23
- #
24
- #
25
- # def handle(uri)
26
- # scheme = uri.scheme
27
- # handler = registry(scheme) #=> TCPHandler
28
- # handler.handle
29
- # end
30
- # end
31
- #
32
- module Registry
33
- # Base Registry Error
34
- class Error < Error; end
35
-
36
- def self.extended(klass)
37
- super
38
- klass.extend(ClassMethods)
39
- end
40
-
41
- def self.included(klass)
42
- super
43
- klass.extend(ClassMethods)
44
- klass.__send__(:include, InstanceMethods)
45
- end
46
-
47
- # Class Methods
48
- module ClassMethods
49
- def inherited(klass)
50
- super
51
- klass.instance_variable_set(:@registry, @registry.dup)
52
- end
53
-
54
- # @param [Object] tag the handler identifier in the registry
55
- # @return [Symbol, String, Object] the corresponding handler (if Symbol or String,
56
- # will assume it referes to an autoloaded module, and will load-and-return it).
57
- #
58
- def registry(tag = nil)
59
- @registry ||= {}
60
- return @registry if tag.nil?
61
-
62
- handler = @registry[tag]
63
- raise(Error, "#{tag} is not registered in #{self}") unless handler
64
-
65
- handler
66
- end
67
-
68
- # @param [Object] tag the identifier for the handler in the registry
69
- # @return [Symbol, String, Object] the handler (if Symbol or String, it is
70
- # assumed to be an autoloaded module, to be loaded later)
71
- #
72
- def register(tag, handler)
73
- registry[tag] = handler
74
- end
75
- end
76
-
77
- # Instance Methods
78
- module InstanceMethods
79
- # delegates to HTTPX::Registry#registry
80
- def registry(tag)
81
- self.class.registry(tag)
82
- end
83
- end
84
- end
85
- end
data/sig/registry.rbs DELETED
@@ -1,13 +0,0 @@
1
- module HTTPX::Registry[unchecked out T, unchecked out V]
2
- class Error < HTTPX::Error
3
- end
4
-
5
- # type registrable = Symbol | String | Class
6
-
7
- def self.registry: [T, V] (T) -> Class
8
- | [T, V] () -> Hash[T, V]
9
-
10
- def self.register: [T, V] (T tag, V handler) -> void
11
-
12
- def registry: (?T tag) -> V
13
- end