httpx 0.11.3 → 0.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/doc/release_notes/0_10_1.md +1 -1
  4. data/doc/release_notes/0_11_1.md +5 -1
  5. data/doc/release_notes/0_12_0.md +55 -0
  6. data/doc/release_notes/0_13_0.md +58 -0
  7. data/doc/release_notes/0_13_1.md +5 -0
  8. data/doc/release_notes/0_13_2.md +9 -0
  9. data/doc/release_notes/0_14_0.md +79 -0
  10. data/lib/httpx.rb +3 -3
  11. data/lib/httpx/adapters/faraday.rb +4 -6
  12. data/lib/httpx/altsvc.rb +1 -0
  13. data/lib/httpx/callbacks.rb +12 -3
  14. data/lib/httpx/chainable.rb +2 -2
  15. data/lib/httpx/connection.rb +92 -37
  16. data/lib/httpx/connection/http1.rb +37 -19
  17. data/lib/httpx/connection/http2.rb +82 -31
  18. data/lib/httpx/headers.rb +1 -1
  19. data/lib/httpx/io.rb +16 -3
  20. data/lib/httpx/io/ssl.rb +35 -24
  21. data/lib/httpx/io/tcp.rb +50 -28
  22. data/lib/httpx/io/tls.rb +218 -0
  23. data/lib/httpx/io/tls/box.rb +365 -0
  24. data/lib/httpx/io/tls/context.rb +199 -0
  25. data/lib/httpx/io/tls/ffi.rb +390 -0
  26. data/lib/httpx/io/udp.rb +31 -7
  27. data/lib/httpx/io/unix.rb +27 -12
  28. data/lib/httpx/options.rb +97 -74
  29. data/lib/httpx/parser/http1.rb +4 -4
  30. data/lib/httpx/plugins/aws_sdk_authentication.rb +84 -0
  31. data/lib/httpx/plugins/aws_sigv4.rb +219 -0
  32. data/lib/httpx/plugins/basic_authentication.rb +8 -3
  33. data/lib/httpx/plugins/compression.rb +24 -12
  34. data/lib/httpx/plugins/compression/brotli.rb +10 -7
  35. data/lib/httpx/plugins/compression/deflate.rb +8 -10
  36. data/lib/httpx/plugins/compression/gzip.rb +4 -3
  37. data/lib/httpx/plugins/cookies.rb +3 -7
  38. data/lib/httpx/plugins/digest_authentication.rb +5 -5
  39. data/lib/httpx/plugins/expect.rb +6 -6
  40. data/lib/httpx/plugins/follow_redirects.rb +4 -4
  41. data/lib/httpx/plugins/grpc.rb +247 -0
  42. data/lib/httpx/plugins/grpc/call.rb +62 -0
  43. data/lib/httpx/plugins/grpc/message.rb +85 -0
  44. data/lib/httpx/plugins/h2c.rb +43 -58
  45. data/lib/httpx/plugins/internal_telemetry.rb +93 -0
  46. data/lib/httpx/plugins/multipart.rb +2 -0
  47. data/lib/httpx/plugins/multipart/encoder.rb +4 -9
  48. data/lib/httpx/plugins/multipart/part.rb +1 -1
  49. data/lib/httpx/plugins/proxy.rb +4 -8
  50. data/lib/httpx/plugins/proxy/http.rb +1 -1
  51. data/lib/httpx/plugins/proxy/socks4.rb +8 -0
  52. data/lib/httpx/plugins/proxy/socks5.rb +8 -0
  53. data/lib/httpx/plugins/proxy/ssh.rb +3 -3
  54. data/lib/httpx/plugins/push_promise.rb +3 -2
  55. data/lib/httpx/plugins/rate_limiter.rb +1 -1
  56. data/lib/httpx/plugins/retries.rb +15 -16
  57. data/lib/httpx/plugins/stream.rb +99 -77
  58. data/lib/httpx/plugins/upgrade.rb +84 -0
  59. data/lib/httpx/plugins/upgrade/h2.rb +54 -0
  60. data/lib/httpx/pool.rb +14 -6
  61. data/lib/httpx/registry.rb +1 -7
  62. data/lib/httpx/request.rb +36 -3
  63. data/lib/httpx/resolver/https.rb +3 -11
  64. data/lib/httpx/resolver/native.rb +7 -3
  65. data/lib/httpx/response.rb +18 -7
  66. data/lib/httpx/selector.rb +5 -0
  67. data/lib/httpx/session.rb +41 -8
  68. data/lib/httpx/transcoder/body.rb +3 -5
  69. data/lib/httpx/transcoder/chunker.rb +1 -1
  70. data/lib/httpx/version.rb +1 -1
  71. data/sig/callbacks.rbs +2 -0
  72. data/sig/chainable.rbs +2 -1
  73. data/sig/connection/http1.rbs +7 -2
  74. data/sig/connection/http2.rbs +10 -4
  75. data/sig/options.rbs +16 -22
  76. data/sig/plugins/aws_sdk_authentication.rbs +19 -0
  77. data/sig/plugins/aws_sigv4.rbs +64 -0
  78. data/sig/plugins/basic_authentication.rbs +2 -0
  79. data/sig/plugins/compression.rbs +7 -5
  80. data/sig/plugins/compression/brotli.rbs +1 -1
  81. data/sig/plugins/compression/deflate.rbs +1 -1
  82. data/sig/plugins/compression/gzip.rbs +1 -1
  83. data/sig/plugins/cookies.rbs +0 -1
  84. data/sig/plugins/digest_authentication.rbs +0 -1
  85. data/sig/plugins/expect.rbs +0 -2
  86. data/sig/plugins/follow_redirects.rbs +0 -2
  87. data/sig/plugins/h2c.rbs +5 -10
  88. data/sig/plugins/persistent.rbs +0 -1
  89. data/sig/plugins/proxy.rbs +0 -1
  90. data/sig/plugins/push_promise.rbs +1 -1
  91. data/sig/plugins/retries.rbs +0 -4
  92. data/sig/plugins/stream.rbs +17 -16
  93. data/sig/plugins/upgrade.rbs +23 -0
  94. data/sig/request.rbs +7 -2
  95. data/sig/response.rbs +4 -1
  96. data/sig/session.rbs +4 -0
  97. metadata +56 -33
  98. data/lib/httpx/timeout.rb +0 -67
  99. data/sig/timeout.rbs +0 -29
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