httpx-patched 1.6.2.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 (336) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +191 -0
  3. data/README.md +162 -0
  4. data/doc/release_notes/0_0_1.md +7 -0
  5. data/doc/release_notes/0_0_2.md +9 -0
  6. data/doc/release_notes/0_0_3.md +9 -0
  7. data/doc/release_notes/0_0_4.md +7 -0
  8. data/doc/release_notes/0_0_5.md +5 -0
  9. data/doc/release_notes/0_10_0.md +66 -0
  10. data/doc/release_notes/0_10_1.md +37 -0
  11. data/doc/release_notes/0_10_2.md +5 -0
  12. data/doc/release_notes/0_11_0.md +74 -0
  13. data/doc/release_notes/0_11_1.md +5 -0
  14. data/doc/release_notes/0_11_2.md +5 -0
  15. data/doc/release_notes/0_11_3.md +5 -0
  16. data/doc/release_notes/0_12_0.md +55 -0
  17. data/doc/release_notes/0_13_0.md +58 -0
  18. data/doc/release_notes/0_13_1.md +5 -0
  19. data/doc/release_notes/0_13_2.md +9 -0
  20. data/doc/release_notes/0_14_0.md +79 -0
  21. data/doc/release_notes/0_14_1.md +7 -0
  22. data/doc/release_notes/0_14_2.md +6 -0
  23. data/doc/release_notes/0_14_3.md +5 -0
  24. data/doc/release_notes/0_14_4.md +5 -0
  25. data/doc/release_notes/0_14_5.md +11 -0
  26. data/doc/release_notes/0_15_0.md +53 -0
  27. data/doc/release_notes/0_15_1.md +8 -0
  28. data/doc/release_notes/0_15_2.md +9 -0
  29. data/doc/release_notes/0_15_3.md +5 -0
  30. data/doc/release_notes/0_15_4.md +5 -0
  31. data/doc/release_notes/0_16_0.md +93 -0
  32. data/doc/release_notes/0_16_1.md +5 -0
  33. data/doc/release_notes/0_17_0.md +49 -0
  34. data/doc/release_notes/0_18_0.md +69 -0
  35. data/doc/release_notes/0_18_1.md +12 -0
  36. data/doc/release_notes/0_18_2.md +10 -0
  37. data/doc/release_notes/0_18_3.md +7 -0
  38. data/doc/release_notes/0_18_4.md +14 -0
  39. data/doc/release_notes/0_18_5.md +10 -0
  40. data/doc/release_notes/0_18_6.md +5 -0
  41. data/doc/release_notes/0_18_7.md +5 -0
  42. data/doc/release_notes/0_19_0.md +39 -0
  43. data/doc/release_notes/0_19_1.md +5 -0
  44. data/doc/release_notes/0_19_2.md +7 -0
  45. data/doc/release_notes/0_19_3.md +6 -0
  46. data/doc/release_notes/0_19_4.md +14 -0
  47. data/doc/release_notes/0_19_5.md +13 -0
  48. data/doc/release_notes/0_19_6.md +5 -0
  49. data/doc/release_notes/0_19_7.md +5 -0
  50. data/doc/release_notes/0_19_8.md +5 -0
  51. data/doc/release_notes/0_1_0.md +9 -0
  52. data/doc/release_notes/0_20_0.md +36 -0
  53. data/doc/release_notes/0_20_1.md +5 -0
  54. data/doc/release_notes/0_20_2.md +7 -0
  55. data/doc/release_notes/0_20_3.md +6 -0
  56. data/doc/release_notes/0_20_4.md +17 -0
  57. data/doc/release_notes/0_20_5.md +3 -0
  58. data/doc/release_notes/0_21_0.md +96 -0
  59. data/doc/release_notes/0_21_1.md +12 -0
  60. data/doc/release_notes/0_22_0.md +13 -0
  61. data/doc/release_notes/0_22_1.md +11 -0
  62. data/doc/release_notes/0_22_2.md +5 -0
  63. data/doc/release_notes/0_22_3.md +55 -0
  64. data/doc/release_notes/0_22_4.md +6 -0
  65. data/doc/release_notes/0_22_5.md +6 -0
  66. data/doc/release_notes/0_23_0.md +42 -0
  67. data/doc/release_notes/0_23_1.md +5 -0
  68. data/doc/release_notes/0_23_2.md +5 -0
  69. data/doc/release_notes/0_23_3.md +6 -0
  70. data/doc/release_notes/0_23_4.md +5 -0
  71. data/doc/release_notes/0_24_0.md +48 -0
  72. data/doc/release_notes/0_24_1.md +12 -0
  73. data/doc/release_notes/0_24_2.md +12 -0
  74. data/doc/release_notes/0_24_3.md +12 -0
  75. data/doc/release_notes/0_24_4.md +18 -0
  76. data/doc/release_notes/0_24_5.md +6 -0
  77. data/doc/release_notes/0_24_6.md +5 -0
  78. data/doc/release_notes/0_24_7.md +10 -0
  79. data/doc/release_notes/0_2_0.md +5 -0
  80. data/doc/release_notes/0_2_1.md +16 -0
  81. data/doc/release_notes/0_3_0.md +12 -0
  82. data/doc/release_notes/0_3_1.md +6 -0
  83. data/doc/release_notes/0_4_0.md +51 -0
  84. data/doc/release_notes/0_4_1.md +3 -0
  85. data/doc/release_notes/0_5_0.md +15 -0
  86. data/doc/release_notes/0_5_1.md +14 -0
  87. data/doc/release_notes/0_6_0.md +5 -0
  88. data/doc/release_notes/0_6_1.md +6 -0
  89. data/doc/release_notes/0_6_2.md +6 -0
  90. data/doc/release_notes/0_6_3.md +13 -0
  91. data/doc/release_notes/0_6_4.md +21 -0
  92. data/doc/release_notes/0_6_5.md +22 -0
  93. data/doc/release_notes/0_6_6.md +19 -0
  94. data/doc/release_notes/0_6_7.md +5 -0
  95. data/doc/release_notes/0_7_0.md +46 -0
  96. data/doc/release_notes/0_8_0.md +27 -0
  97. data/doc/release_notes/0_8_1.md +8 -0
  98. data/doc/release_notes/0_8_2.md +7 -0
  99. data/doc/release_notes/0_9_0.md +38 -0
  100. data/doc/release_notes/1_0_0.md +60 -0
  101. data/doc/release_notes/1_0_1.md +5 -0
  102. data/doc/release_notes/1_0_2.md +7 -0
  103. data/doc/release_notes/1_1_0.md +32 -0
  104. data/doc/release_notes/1_1_1.md +17 -0
  105. data/doc/release_notes/1_1_2.md +12 -0
  106. data/doc/release_notes/1_1_3.md +18 -0
  107. data/doc/release_notes/1_1_4.md +6 -0
  108. data/doc/release_notes/1_1_5.md +12 -0
  109. data/doc/release_notes/1_2_0.md +49 -0
  110. data/doc/release_notes/1_2_1.md +6 -0
  111. data/doc/release_notes/1_2_2.md +10 -0
  112. data/doc/release_notes/1_2_3.md +16 -0
  113. data/doc/release_notes/1_2_4.md +8 -0
  114. data/doc/release_notes/1_2_5.md +7 -0
  115. data/doc/release_notes/1_2_6.md +13 -0
  116. data/doc/release_notes/1_3_0.md +18 -0
  117. data/doc/release_notes/1_3_1.md +17 -0
  118. data/doc/release_notes/1_3_2.md +6 -0
  119. data/doc/release_notes/1_3_3.md +5 -0
  120. data/doc/release_notes/1_3_4.md +6 -0
  121. data/doc/release_notes/1_4_0.md +43 -0
  122. data/doc/release_notes/1_4_1.md +19 -0
  123. data/doc/release_notes/1_4_2.md +20 -0
  124. data/doc/release_notes/1_4_3.md +11 -0
  125. data/doc/release_notes/1_4_4.md +14 -0
  126. data/doc/release_notes/1_5_0.md +126 -0
  127. data/doc/release_notes/1_5_1.md +6 -0
  128. data/doc/release_notes/1_6_0.md +50 -0
  129. data/doc/release_notes/1_6_1.md +17 -0
  130. data/doc/release_notes/1_6_2.md +11 -0
  131. data/lib/httpx/adapters/datadog.rb +359 -0
  132. data/lib/httpx/adapters/faraday.rb +303 -0
  133. data/lib/httpx/adapters/sentry.rb +121 -0
  134. data/lib/httpx/adapters/webmock.rb +175 -0
  135. data/lib/httpx/altsvc.rb +163 -0
  136. data/lib/httpx/base64.rb +27 -0
  137. data/lib/httpx/buffer.rb +61 -0
  138. data/lib/httpx/callbacks.rb +35 -0
  139. data/lib/httpx/chainable.rb +106 -0
  140. data/lib/httpx/connection/http1.rb +399 -0
  141. data/lib/httpx/connection/http2.rb +468 -0
  142. data/lib/httpx/connection.rb +954 -0
  143. data/lib/httpx/domain_name.rb +145 -0
  144. data/lib/httpx/errors.rb +111 -0
  145. data/lib/httpx/extensions.rb +59 -0
  146. data/lib/httpx/headers.rb +176 -0
  147. data/lib/httpx/io/ssl.rb +163 -0
  148. data/lib/httpx/io/tcp.rb +239 -0
  149. data/lib/httpx/io/udp.rb +62 -0
  150. data/lib/httpx/io/unix.rb +71 -0
  151. data/lib/httpx/io.rb +11 -0
  152. data/lib/httpx/loggable.rb +56 -0
  153. data/lib/httpx/options.rb +463 -0
  154. data/lib/httpx/parser/http1.rb +186 -0
  155. data/lib/httpx/plugins/auth/basic.rb +20 -0
  156. data/lib/httpx/plugins/auth/digest.rb +102 -0
  157. data/lib/httpx/plugins/auth/ntlm.rb +35 -0
  158. data/lib/httpx/plugins/auth/socks5.rb +22 -0
  159. data/lib/httpx/plugins/auth.rb +25 -0
  160. data/lib/httpx/plugins/aws_sdk_authentication.rb +111 -0
  161. data/lib/httpx/plugins/aws_sigv4.rb +239 -0
  162. data/lib/httpx/plugins/basic_auth.rb +29 -0
  163. data/lib/httpx/plugins/brotli.rb +50 -0
  164. data/lib/httpx/plugins/callbacks.rb +127 -0
  165. data/lib/httpx/plugins/circuit_breaker/circuit.rb +100 -0
  166. data/lib/httpx/plugins/circuit_breaker/circuit_store.rb +53 -0
  167. data/lib/httpx/plugins/circuit_breaker.rb +147 -0
  168. data/lib/httpx/plugins/content_digest.rb +204 -0
  169. data/lib/httpx/plugins/cookies/cookie.rb +174 -0
  170. data/lib/httpx/plugins/cookies/jar.rb +95 -0
  171. data/lib/httpx/plugins/cookies/set_cookie_parser.rb +143 -0
  172. data/lib/httpx/plugins/cookies.rb +107 -0
  173. data/lib/httpx/plugins/digest_auth.rb +67 -0
  174. data/lib/httpx/plugins/expect.rb +120 -0
  175. data/lib/httpx/plugins/fiber_concurrency.rb +195 -0
  176. data/lib/httpx/plugins/follow_redirects.rb +233 -0
  177. data/lib/httpx/plugins/grpc/call.rb +63 -0
  178. data/lib/httpx/plugins/grpc/grpc_encoding.rb +90 -0
  179. data/lib/httpx/plugins/grpc/message.rb +55 -0
  180. data/lib/httpx/plugins/grpc.rb +282 -0
  181. data/lib/httpx/plugins/h2c.rb +127 -0
  182. data/lib/httpx/plugins/internal_telemetry.rb +107 -0
  183. data/lib/httpx/plugins/ntlm_auth.rb +62 -0
  184. data/lib/httpx/plugins/oauth.rb +183 -0
  185. data/lib/httpx/plugins/persistent.rb +82 -0
  186. data/lib/httpx/plugins/proxy/http.rb +184 -0
  187. data/lib/httpx/plugins/proxy/socks4.rb +135 -0
  188. data/lib/httpx/plugins/proxy/socks5.rb +194 -0
  189. data/lib/httpx/plugins/proxy/ssh.rb +94 -0
  190. data/lib/httpx/plugins/proxy.rb +349 -0
  191. data/lib/httpx/plugins/push_promise.rb +81 -0
  192. data/lib/httpx/plugins/query.rb +35 -0
  193. data/lib/httpx/plugins/rate_limiter.rb +55 -0
  194. data/lib/httpx/plugins/response_cache/file_store.rb +140 -0
  195. data/lib/httpx/plugins/response_cache/store.rb +33 -0
  196. data/lib/httpx/plugins/response_cache.rb +333 -0
  197. data/lib/httpx/plugins/retries.rb +230 -0
  198. data/lib/httpx/plugins/ssrf_filter.rb +145 -0
  199. data/lib/httpx/plugins/stream.rb +183 -0
  200. data/lib/httpx/plugins/stream_bidi.rb +315 -0
  201. data/lib/httpx/plugins/upgrade/h2.rb +64 -0
  202. data/lib/httpx/plugins/upgrade.rb +86 -0
  203. data/lib/httpx/plugins/webdav.rb +86 -0
  204. data/lib/httpx/plugins/xml.rb +76 -0
  205. data/lib/httpx/pmatch_extensions.rb +33 -0
  206. data/lib/httpx/pool.rb +190 -0
  207. data/lib/httpx/punycode.rb +22 -0
  208. data/lib/httpx/request/body.rb +158 -0
  209. data/lib/httpx/request.rb +328 -0
  210. data/lib/httpx/resolver/entry.rb +30 -0
  211. data/lib/httpx/resolver/https.rb +256 -0
  212. data/lib/httpx/resolver/multi.rb +102 -0
  213. data/lib/httpx/resolver/native.rb +547 -0
  214. data/lib/httpx/resolver/resolver.rb +173 -0
  215. data/lib/httpx/resolver/system.rb +255 -0
  216. data/lib/httpx/resolver.rb +189 -0
  217. data/lib/httpx/response/body.rb +242 -0
  218. data/lib/httpx/response/buffer.rb +115 -0
  219. data/lib/httpx/response.rb +304 -0
  220. data/lib/httpx/selector.rb +282 -0
  221. data/lib/httpx/session.rb +612 -0
  222. data/lib/httpx/session_extensions.rb +30 -0
  223. data/lib/httpx/timers.rb +133 -0
  224. data/lib/httpx/transcoder/body.rb +43 -0
  225. data/lib/httpx/transcoder/chunker.rb +115 -0
  226. data/lib/httpx/transcoder/deflate.rb +37 -0
  227. data/lib/httpx/transcoder/form.rb +68 -0
  228. data/lib/httpx/transcoder/gzip.rb +71 -0
  229. data/lib/httpx/transcoder/json.rb +71 -0
  230. data/lib/httpx/transcoder/multipart/decoder.rb +141 -0
  231. data/lib/httpx/transcoder/multipart/encoder.rb +120 -0
  232. data/lib/httpx/transcoder/multipart/mime_type_detector.rb +78 -0
  233. data/lib/httpx/transcoder/multipart/part.rb +35 -0
  234. data/lib/httpx/transcoder/multipart.rb +31 -0
  235. data/lib/httpx/transcoder/utils/body_reader.rb +46 -0
  236. data/lib/httpx/transcoder/utils/deflater.rb +75 -0
  237. data/lib/httpx/transcoder.rb +91 -0
  238. data/lib/httpx/utils.rb +75 -0
  239. data/lib/httpx/version.rb +5 -0
  240. data/lib/httpx.rb +66 -0
  241. data/sig/altsvc.rbs +33 -0
  242. data/sig/buffer.rbs +27 -0
  243. data/sig/callbacks.rbs +15 -0
  244. data/sig/chainable.rbs +55 -0
  245. data/sig/connection/http1.rbs +85 -0
  246. data/sig/connection/http2.rbs +116 -0
  247. data/sig/connection.rbs +169 -0
  248. data/sig/domain_name.rbs +17 -0
  249. data/sig/errors.rbs +69 -0
  250. data/sig/headers.rbs +49 -0
  251. data/sig/httpx.rbs +27 -0
  252. data/sig/io/ssl.rbs +27 -0
  253. data/sig/io/tcp.rbs +72 -0
  254. data/sig/io/udp.rbs +25 -0
  255. data/sig/io/unix.rbs +26 -0
  256. data/sig/io.rbs +3 -0
  257. data/sig/loggable.rbs +17 -0
  258. data/sig/options.rbs +202 -0
  259. data/sig/parser/http1.rbs +59 -0
  260. data/sig/plugins/auth/basic.rbs +17 -0
  261. data/sig/plugins/auth/digest.rbs +25 -0
  262. data/sig/plugins/auth/ntlm.rbs +20 -0
  263. data/sig/plugins/auth/socks5.rbs +18 -0
  264. data/sig/plugins/auth.rbs +13 -0
  265. data/sig/plugins/aws_sdk_authentication.rbs +43 -0
  266. data/sig/plugins/aws_sigv4.rbs +78 -0
  267. data/sig/plugins/basic_auth.rbs +15 -0
  268. data/sig/plugins/brotli.rbs +22 -0
  269. data/sig/plugins/callbacks.rbs +38 -0
  270. data/sig/plugins/circuit_breaker.rbs +71 -0
  271. data/sig/plugins/compression.rbs +57 -0
  272. data/sig/plugins/content_digest.rbs +51 -0
  273. data/sig/plugins/cookies/cookie.rbs +55 -0
  274. data/sig/plugins/cookies/jar.rbs +26 -0
  275. data/sig/plugins/cookies/set_cookie_parser.rbs +22 -0
  276. data/sig/plugins/cookies.rbs +28 -0
  277. data/sig/plugins/digest_auth.rbs +21 -0
  278. data/sig/plugins/expect.rbs +15 -0
  279. data/sig/plugins/fiber_concurrency.rbs +51 -0
  280. data/sig/plugins/follow_redirects.rbs +47 -0
  281. data/sig/plugins/grpc/call.rbs +23 -0
  282. data/sig/plugins/grpc/grpc_encoding.rbs +37 -0
  283. data/sig/plugins/grpc/message.rbs +17 -0
  284. data/sig/plugins/grpc.rbs +65 -0
  285. data/sig/plugins/h2c.rbs +27 -0
  286. data/sig/plugins/ntlm_auth.rbs +21 -0
  287. data/sig/plugins/oauth.rbs +68 -0
  288. data/sig/plugins/persistent.rbs +14 -0
  289. data/sig/plugins/proxy/http.rbs +30 -0
  290. data/sig/plugins/proxy/socks4.rbs +37 -0
  291. data/sig/plugins/proxy/socks5.rbs +49 -0
  292. data/sig/plugins/proxy/ssh.rbs +18 -0
  293. data/sig/plugins/proxy.rbs +70 -0
  294. data/sig/plugins/push_promise.rbs +23 -0
  295. data/sig/plugins/query.rbs +18 -0
  296. data/sig/plugins/rate_limiter.rbs +13 -0
  297. data/sig/plugins/response_cache/file_store.rbs +19 -0
  298. data/sig/plugins/response_cache/store.rbs +13 -0
  299. data/sig/plugins/response_cache.rbs +86 -0
  300. data/sig/plugins/retries.rbs +66 -0
  301. data/sig/plugins/ssrf_filter.rbs +26 -0
  302. data/sig/plugins/stream.rbs +54 -0
  303. data/sig/plugins/stream_bidi.rbs +68 -0
  304. data/sig/plugins/upgrade/h2.rbs +9 -0
  305. data/sig/plugins/upgrade.rbs +29 -0
  306. data/sig/plugins/webdav.rbs +23 -0
  307. data/sig/plugins/xml.rbs +37 -0
  308. data/sig/pool.rbs +51 -0
  309. data/sig/punycode.rbs +5 -0
  310. data/sig/request/body.rbs +34 -0
  311. data/sig/request.rbs +88 -0
  312. data/sig/resolver/entry.rbs +13 -0
  313. data/sig/resolver/https.rbs +45 -0
  314. data/sig/resolver/multi.rbs +32 -0
  315. data/sig/resolver/native.rbs +74 -0
  316. data/sig/resolver/resolver.rbs +64 -0
  317. data/sig/resolver/system.rbs +34 -0
  318. data/sig/resolver.rbs +48 -0
  319. data/sig/response/body.rbs +52 -0
  320. data/sig/response/buffer.rbs +23 -0
  321. data/sig/response.rbs +103 -0
  322. data/sig/selector.rbs +68 -0
  323. data/sig/session.rbs +104 -0
  324. data/sig/timers.rbs +54 -0
  325. data/sig/transcoder/body.rbs +24 -0
  326. data/sig/transcoder/chunker.rbs +49 -0
  327. data/sig/transcoder/deflate.rbs +12 -0
  328. data/sig/transcoder/form.rbs +34 -0
  329. data/sig/transcoder/gzip.rbs +27 -0
  330. data/sig/transcoder/json.rbs +28 -0
  331. data/sig/transcoder/multipart.rbs +103 -0
  332. data/sig/transcoder/utils/body_reader.rbs +15 -0
  333. data/sig/transcoder/utils/deflater.rbs +28 -0
  334. data/sig/transcoder.rbs +43 -0
  335. data/sig/utils.rbs +19 -0
  336. metadata +518 -0
@@ -0,0 +1,71 @@
1
+ module HTTPX
2
+ module Plugins
3
+ module CircuitBreaker
4
+
5
+ class CircuitStore
6
+ @circuits: Hash[String, Circuit]
7
+
8
+ @circuits_mutex: Thread::Mutex
9
+
10
+ def try_open: (uri uri, response response) -> response?
11
+
12
+ def try_respond: (Request request) -> response?
13
+
14
+ def try_close: (http_uri uri) -> void
15
+
16
+ private
17
+
18
+ def get_circuit_for_uri: (uri uri) -> Circuit
19
+
20
+ def initialize: (Options & _CircuitOptions options) -> void
21
+ end
22
+
23
+ class Circuit
24
+ @state: :closed | :open | :half_open
25
+ @max_attempts: Integer
26
+ @reset_attempts_in: Float
27
+ @break_in: Float
28
+ @circuit_breaker_half_open_drip_rate: Float
29
+ @attempts: Integer
30
+ @real_attempts: Integer
31
+ @drip_factor: Integer
32
+
33
+ @response: response?
34
+ @opened_at: Float?
35
+ @attempted_at: Float?
36
+
37
+ def respond: () -> response?
38
+
39
+ def try_open: (response) -> response?
40
+
41
+ def try_close: () -> void
42
+
43
+ private
44
+
45
+ def initialize: (Integer max_attempts, Float reset_attempts_in, Float break_in, Float circuit_breaker_half_open_drip_rate) -> void
46
+ end
47
+
48
+ interface _CircuitOptions
49
+ def circuit_breaker_max_attempts: () -> Integer
50
+ def circuit_breaker_reset_attempts_in: () -> Float
51
+ def circuit_breaker_break_in: () -> Float
52
+ def circuit_breaker_half_open_drip_rate: () -> Float
53
+ def circuit_breaker_break_on: () -> (^(Response) -> boolish | nil)
54
+ end
55
+
56
+ def self.load_dependencies: (singleton(Session)) -> void
57
+ def self.extra_options: (Options) -> (Options & _CircuitOptions)
58
+
59
+ module InstanceMethods
60
+ @circuit_store: CircuitStore
61
+
62
+ private
63
+
64
+ def try_circuit_open: (Request request, response response) -> response?
65
+ end
66
+
67
+ end
68
+
69
+ type sessionCircuitBreaker = Session & CircuitBreaker::InstanceMethods
70
+ end
71
+ end
@@ -0,0 +1,57 @@
1
+ module HTTPX
2
+ module Plugins
3
+ module Compression
4
+
5
+ type deflatable = _Reader | _ToS
6
+
7
+ interface _Deflater
8
+ def deflate: (deflatable, ?_Writer, ?chunk_size: Integer) -> _ToS
9
+ | (deflatable, ?_Writer, ?chunk_size: Integer) { (String) -> void } -> _ToS
10
+ end
11
+
12
+ interface _Inflater
13
+ def inflate: (string) -> String
14
+
15
+ def initialize: (Integer | Float bytesize) -> untyped
16
+ end
17
+
18
+ interface _Compressor
19
+ def deflater: () -> _Deflater
20
+ def inflater: (Integer | Float bytesize) -> _Inflater
21
+ end
22
+
23
+ def self.configure: (singleton(Session)) -> void
24
+
25
+ interface _CompressionOptions
26
+ def encodings: () -> Hash[String, _Compressor]
27
+ end
28
+
29
+ def self.extra_options: (Options) -> (Options & _CompressionOptions)
30
+
31
+
32
+ module ResponseBodyMethods
33
+ @encodings: Array[String]
34
+ @_deflaters: Array[_Deflater]
35
+
36
+ private
37
+
38
+ def decompress: (string) -> String
39
+ end
40
+
41
+ class Encoder
42
+ include Transcoder::_Encoder
43
+ include _ToS
44
+ include _Each[String]
45
+
46
+ def close: () -> void
47
+
48
+ private
49
+
50
+ def initialize: (deflatable body, _Deflater deflater) -> untyped
51
+ def deflate: () -> void
52
+ | () { (String) -> void } -> void
53
+ end
54
+
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,51 @@
1
+ module HTTPX
2
+ module Plugins
3
+ module ContentDigest
4
+ class Error < HTTPX::Error
5
+ end
6
+ class ValidationError < Error
7
+ attr_reader response: Response
8
+
9
+ def initialize: (String message, Response response) -> void
10
+ end
11
+ class MissingContentDigestError < ValidationError
12
+ end
13
+ class InvalidContentDigestError < ValidationError
14
+ end
15
+
16
+ SUPPORTED_ALGORITHMS: Hash[String, singleton(OpenSSL::Digest)]
17
+
18
+ interface _ContentDigestOptions
19
+ def digest_algorithm: () -> String
20
+ def encode_content_digest: () -> (bool | ^(Request) -> boolish)
21
+ def validate_content_digest: () -> (bool | ^(contentDigestResponse) -> boolish)
22
+ end
23
+
24
+ # def self.extra_options: (Options) -> contentDigestOptions
25
+
26
+ module InstanceMethods
27
+ private
28
+
29
+ def validate_content_digest: (Response response) -> void
30
+
31
+ def extract_content_digests: (String) -> Hash[String, String]
32
+
33
+ def base64digest: (Request::Body | contentDigestResponseBody body) -> String
34
+ end
35
+
36
+ module ResponseMethods
37
+ attr_reader body: contentDigestResponseBody
38
+ end
39
+
40
+ module ResponseBodyMethods
41
+ attr_reader content_digest_buffer: Response::Buffer?
42
+ end
43
+
44
+ type contentDigestOptions = Options & _ContentDigestOptions
45
+ type contentDigestResponse = Response & ResponseMethods
46
+ type contentDigestResponseBody = Response::Body & ResponseBodyMethods
47
+ end
48
+
49
+ type sessionContentDigest = Session & ContentDigest::InstanceMethods
50
+ end
51
+ end
@@ -0,0 +1,55 @@
1
+ module HTTPX
2
+ module Plugins::Cookies
3
+ class Cookie
4
+ include Comparable
5
+
6
+ MAX_LENGTH: Integer
7
+
8
+ attr_reader domain: DomainName?
9
+
10
+ attr_reader path: String
11
+
12
+ attr_reader name: String
13
+
14
+ attr_reader value: String?
15
+
16
+ attr_reader created_at: Time
17
+
18
+ @for_domain: bool
19
+
20
+ @domain_name: DomainName
21
+
22
+ def path=: (string) -> void
23
+
24
+ def domain=: (string) -> void
25
+
26
+ def expires: () -> Time?
27
+
28
+ def expired?: () -> bool
29
+ | (Time) -> bool
30
+
31
+ def cookie_value: () -> String
32
+ alias to_s cookie_value
33
+
34
+ def valid_for_uri?: (http_uri uri) -> bool
35
+
36
+ def self.new: (Cookie) -> instance
37
+ | (cookie_attributes) -> instance
38
+ | (_ToS, _ToS, ?cookie_attributes) -> instance
39
+
40
+ def self.path_match?: (String, String) -> bool
41
+
42
+ private
43
+
44
+ def initialize: (cookie_attributes) -> untyped
45
+ | (_ToS, _ToS, ?cookie_attributes) -> untyped
46
+
47
+ def acceptable_from_uri?: (uri) -> bool
48
+
49
+ module Scanner
50
+ RE_BAD_CHAR: Regexp
51
+ def self?.quote: (String s) -> String
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,26 @@
1
+ module HTTPX
2
+ module Plugins::Cookies
3
+ class Jar
4
+ type cookie = Cookie | Array[[String, String, cookie_attributes]] | Array[[String, String]] | cookie_attributes
5
+
6
+ include Enumerable[Cookie]
7
+
8
+ @cookies: Array[Cookie]
9
+
10
+ def parse: (String set_cookie) -> void
11
+
12
+ def add: (Cookie name, ?String path) -> void
13
+
14
+ def []: (http_uri) -> Array[Cookie]
15
+
16
+ def each: (?http_uri?) { (Cookie) -> void } -> void
17
+ | (?http_uri?) -> Enumerable[Cookie]
18
+
19
+ def merge: (_Each[cookie] cookies) -> self
20
+
21
+ private
22
+
23
+ def initialize: (?_Each[cookie] cookies) -> untyped
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,22 @@
1
+ module HTTPX
2
+ module Plugins::Cookies
3
+ module SetCookieParser
4
+ RE_WSP: Regexp
5
+
6
+ RE_NAME: Regexp
7
+
8
+ RE_BAD_CHAR: Regexp
9
+
10
+ RE_COOKIE_COMMA: Regexp
11
+
12
+ def self?.call: (String set_cookie) { (String name, String value, cookie_attributes attrs) -> void } -> void
13
+
14
+ def self?.scan_dquoted: (StringScanner scanner) -> String
15
+
16
+ def self?.scan_value: (StringScanner scanner, ?bool comma_as_separator) -> String
17
+
18
+ def self?.scan_name_value: (StringScanner scanner, ?bool comma_as_separator) -> [String?, String?]
19
+
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,28 @@
1
+ module HTTPX
2
+ module Plugins
3
+ module Cookies
4
+ type cookie_attributes = Hash[Symbol | String, top]
5
+
6
+ type jar = Jar | _Each[Jar::cookie]
7
+
8
+ interface _CookieOptions
9
+ def cookies: () -> Jar?
10
+
11
+ def merge_cookie_in_jar: (Array[String] cookies, Jar jar) -> void
12
+ end
13
+
14
+ def self.extra_options: (Options) -> (Options & _CookieOptions)
15
+
16
+ module InstanceMethods
17
+ def cookies: () -> Jar
18
+ end
19
+
20
+ module HeadersMethods
21
+ def set_cookie: (Array[Cookie]) -> void
22
+ end
23
+ end
24
+
25
+ type sessionCookies = Session & Cookies::InstanceMethods
26
+ type headersCookies = Headers & Cookies::HeadersMethods
27
+ end
28
+ end
@@ -0,0 +1,21 @@
1
+ module HTTPX
2
+ module Plugins
3
+ module DigestAuth
4
+ DigestError: singleton(Error)
5
+
6
+ interface _DigestOptions
7
+ def digest: () -> Authentication::Digest?
8
+ end
9
+
10
+ def self.extra_options: (Options) -> (Options & _DigestOptions)
11
+
12
+ def self.load_dependencies: (*untyped) -> void
13
+
14
+ module InstanceMethods
15
+ def digest_auth: (string user, string password, ?hashed: bool) -> instance
16
+ end
17
+ end
18
+
19
+ type sessionDigestAuth = sessionAuthorization & DigestAuth::InstanceMethods
20
+ end
21
+ end
@@ -0,0 +1,15 @@
1
+ module HTTPX
2
+ module Plugins
3
+ module Expect
4
+ EXPECT_TIMEOUT: Integer
5
+
6
+ interface _ExpectOptions
7
+ def expect_timeout: () -> Integer?
8
+
9
+ def expect_threshold_size: () -> Integer?
10
+ end
11
+
12
+ def self.extra_options: (Options) -> (Options & _ExpectOptions)
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,51 @@
1
+ module HTTPX
2
+ module Plugins
3
+ module FiberConcurrency
4
+ module InstanceMethods
5
+ end
6
+
7
+ module RequestMethods
8
+ attr_reader context: Fiber?
9
+
10
+ def set_context!: () -> void
11
+
12
+ def current_context?: () -> bool
13
+ end
14
+
15
+ module ConnectionMethods
16
+
17
+ def current_context?: () -> bool
18
+
19
+ def send: (request request) -> void
20
+ end
21
+
22
+ module HTTP1Methods
23
+ end
24
+
25
+ module HTTP2Methods
26
+ @contexts: Hash[Fiber, Set[Request]]
27
+
28
+ private
29
+
30
+ def add_to_context: (request request) -> void
31
+
32
+ def clear_from_context: (request request) -> void
33
+ end
34
+
35
+ module NativeResolverMethods
36
+ end
37
+
38
+ module SystemResolverMethods
39
+ end
40
+
41
+ module FiberConcurrencyH2C
42
+ module HTTP2Methods
43
+ end
44
+ end
45
+
46
+ type request = Request & RequestMethods
47
+ end
48
+
49
+ type sessionFiberConcurrency = Session & FiberConcurrency::InstanceMethods
50
+ end
51
+ end
@@ -0,0 +1,47 @@
1
+ module HTTPX
2
+ InsecureRedirectError: singleton(Error)
3
+
4
+ module Plugins
5
+ module FollowRedirects
6
+ MAX_REDIRECTS: Integer
7
+ REDIRECT_STATUS: Range[Integer]
8
+ REQUEST_BODY_HEADERS: Array[String]
9
+
10
+ type redirect_request = Request & RequestMethods
11
+
12
+ interface _FollowRedirectsOptions
13
+ def max_redirects: () -> Integer?
14
+
15
+ def follow_insecure_redirects: () -> bool?
16
+
17
+ def allow_auth_to_other_origins: () -> bool?
18
+
19
+ def redirect_on: () -> (^(http_uri) -> boolish | nil)
20
+ end
21
+
22
+ def self.extra_options: (Options) -> (Options & _FollowRedirectsOptions)
23
+
24
+ module InstanceMethods
25
+ def max_redirects: (_ToI) -> instance
26
+
27
+ def handle_after_redirect_request: (http_uri original_uri, http_uri redirect_uri, Request request, Options & _FollowRedirectsOptions options) -> void
28
+
29
+ def __get_location_from_response: (Response) -> http_uri
30
+ end
31
+
32
+ module RequestMethods
33
+ attr_accessor root_request: instance?
34
+
35
+ @redirect_request: redirect_request
36
+
37
+ def redirect_request: () -> redirect_request
38
+
39
+ def redirect_request=: (redirect_request req) -> void
40
+
41
+ def max_redirects: () -> Integer
42
+ end
43
+ end
44
+
45
+ type sessionFollowRedirects = Session & FollowRedirects::InstanceMethods
46
+ end
47
+ end
@@ -0,0 +1,23 @@
1
+ module HTTPX
2
+ module Plugins
3
+ module GRPC
4
+ class Call
5
+ attr_writer decoder: _Callable
6
+
7
+ @response: Response | StreamResponse
8
+ @consumed: bool
9
+ @grpc_response: Enumerator[String] | String
10
+
11
+ def metadata: () -> headers
12
+
13
+ def trailing_metadata: () -> headers?
14
+
15
+ private
16
+
17
+ def initialize: (Response | StreamResponse response) -> untyped
18
+
19
+ def grpc_response: () -> grpc_response
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,37 @@
1
+ module HTTPX
2
+ module Transcoder
3
+ module GRPCEncoding
4
+
5
+ def self?.encode: (body_encoder body, compressed: bool) -> Deflater
6
+
7
+ def self?.decode: (Response | StreamResponse response) -> Inflater
8
+
9
+ class Deflater
10
+ attr_reader content_type: String
11
+
12
+ @body: BodyReader
13
+ @compressed: bool
14
+
15
+ def initialize: (body_encoder body, compressed: bool) -> void
16
+
17
+ def bytesize: () -> (Integer | Float)
18
+
19
+ def read: (?int? length, ?string outbuf) -> String?
20
+ end
21
+
22
+ class Inflater
23
+ @response: Response
24
+ @grpc_encodings: Array[String]
25
+
26
+ def initialize: (Response | StreamResponse response) -> void
27
+
28
+ def call: (String message) ?{ (String) -> void } -> String
29
+
30
+ private
31
+
32
+ def grpc_encodings: () -> Array[String]
33
+ end
34
+
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,17 @@
1
+
2
+ module HTTPX
3
+ module Plugins
4
+ module GRPC
5
+ module Message
6
+ def self?.unary: (response) -> grpc_message
7
+
8
+ def self?.stream: (StreamResponse) { (String) -> void } -> void
9
+ | (StreamResponse) -> Enumerable[String]
10
+
11
+ def self?.cancel: (Request) -> void
12
+
13
+ def self?.verify_status: (StreamResponse | response) -> void
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,65 @@
1
+ module HTTPX
2
+ class GRPCError < Error
3
+ attr_reader status: Integer
4
+ attr_reader details: String
5
+ attr_reader metadata: headers
6
+ end
7
+
8
+ module Plugins
9
+ module GRPC
10
+ DEADLINE: Integer
11
+ MARSHAL_METHOD: Symbol
12
+ UNMARSHAL_METHOD: Symbol
13
+ HEADERS: Hash[String, String]
14
+
15
+ type compression_option = bool | String
16
+ type rpc_def = [String, untyped, untyped, Hash[Symbol, untyped]]
17
+
18
+ type grpc_message = String | _Each[String]
19
+
20
+ type grpc_request = untyped | _Each[untyped]
21
+ type grpc_response = untyped | _Each[untyped]
22
+
23
+ type credentials = Proc
24
+
25
+ interface _GRPCOptions
26
+ def grpc_service: () -> String?
27
+
28
+ def grpc_compression: () -> compression_option?
29
+
30
+ def grpc_rpcs: () -> Hash[String, rpc_def]?
31
+
32
+ def grpc_deadline: () -> Integer?
33
+
34
+ def call_credentials: () -> credentials?
35
+ end
36
+
37
+ def self.extra_options: (Options) -> (Options & _GRPCOptions)
38
+ def self.load_dependencies: (singleton(Session)) -> void
39
+
40
+ module ResponseMethods
41
+ attr_reader trailing_metadata: Hash[String, untyped]
42
+
43
+ def encoders: () -> Array[String | Encoding]
44
+ end
45
+
46
+ module InstanceMethods
47
+ def with_channel_credentials: (String ca_path, ?String? key, ?String? cert, **untyped) -> instance
48
+
49
+ def rpc: (_ToS rpc_name, untyped input, untyped output, **untyped) -> instance
50
+
51
+ def build_stub: (string origin, ?service: _ToS, ?compression: compression_option) -> instance
52
+
53
+ def execute: (_ToS rpc_method, grpc_message input, ?deadline: Integer, ?metadata: headers_input, **untyped) -> Call
54
+
55
+ private
56
+
57
+ def rpc_execute: (_ToS rpc_method, grpc_request input, **untyped) -> Call
58
+
59
+ def build_grpc_request: (string rpc_method, grpc_message input, ?deadline: Integer, ?metadata?: headers_input, **untyped) -> Request
60
+ end
61
+ end
62
+
63
+ type grpcSession = Session & GRPC::InstanceMethods
64
+ end
65
+ end
@@ -0,0 +1,27 @@
1
+ module HTTPX
2
+ module Plugins
3
+ module H2C
4
+ VALID_H2C_VERBS: Array[verb]
5
+
6
+ def self.load_dependencies: (*untyped) -> void
7
+ def self.configure: (singleton(Session)) -> void
8
+ def self.call: (Connection, Request, response) -> void
9
+
10
+ interface _H2COptions
11
+ def h2c_class: () -> (singleton(Connection::HTTP2) & H2CParser)
12
+ end
13
+
14
+ module H2CParser
15
+ def upgrade: (Request, Response) -> void
16
+ end
17
+
18
+ module RequestMethods
19
+ def valid_h2c_verb?: () -> bool
20
+ end
21
+
22
+ module ConnectionMethods
23
+ def upgrade_to_h2c: (Request, Response) -> void
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,21 @@
1
+ module HTTPX
2
+ module Plugins
3
+ module NTLMAuth
4
+
5
+ interface _NTLMOptions
6
+ def ntlm: () -> Authentication::Ntlm?
7
+ end
8
+
9
+ def self.extra_options: (Options) -> (Options & _NTLMOptions)
10
+
11
+ def self.load_dependencies: (*untyped) -> void
12
+
13
+ module InstanceMethods
14
+ def ntlm_auth: (string user, string password, ?string? domain) -> instance
15
+ end
16
+
17
+ end
18
+
19
+ type sessionNTLMAuth = sessionAuthorization & NTLMAuth::InstanceMethods
20
+ end
21
+ end