httpx 0.20.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (250) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +0 -48
  3. data/README.md +54 -45
  4. data/doc/release_notes/0_10_0.md +2 -2
  5. data/doc/release_notes/0_11_0.md +3 -5
  6. data/doc/release_notes/0_12_0.md +5 -5
  7. data/doc/release_notes/0_13_0.md +5 -5
  8. data/doc/release_notes/0_14_0.md +2 -2
  9. data/doc/release_notes/0_16_0.md +3 -3
  10. data/doc/release_notes/0_17_0.md +1 -1
  11. data/doc/release_notes/0_18_0.md +4 -4
  12. data/doc/release_notes/0_18_2.md +1 -1
  13. data/doc/release_notes/0_19_0.md +1 -1
  14. data/doc/release_notes/0_19_8.md +1 -1
  15. data/doc/release_notes/0_20_0.md +2 -2
  16. data/doc/release_notes/0_20_1.md +5 -0
  17. data/doc/release_notes/0_20_2.md +7 -0
  18. data/doc/release_notes/0_20_3.md +6 -0
  19. data/doc/release_notes/0_20_4.md +17 -0
  20. data/doc/release_notes/0_20_5.md +3 -0
  21. data/doc/release_notes/0_21_0.md +96 -0
  22. data/doc/release_notes/0_21_1.md +12 -0
  23. data/doc/release_notes/0_22_0.md +13 -0
  24. data/doc/release_notes/0_22_1.md +11 -0
  25. data/doc/release_notes/0_22_2.md +5 -0
  26. data/doc/release_notes/0_22_3.md +55 -0
  27. data/doc/release_notes/0_22_4.md +6 -0
  28. data/doc/release_notes/0_22_5.md +6 -0
  29. data/doc/release_notes/0_23_0.md +42 -0
  30. data/doc/release_notes/0_23_1.md +5 -0
  31. data/doc/release_notes/0_23_2.md +5 -0
  32. data/doc/release_notes/0_23_3.md +6 -0
  33. data/doc/release_notes/0_23_4.md +5 -0
  34. data/doc/release_notes/0_24_0.md +48 -0
  35. data/doc/release_notes/0_24_1.md +12 -0
  36. data/doc/release_notes/0_24_2.md +12 -0
  37. data/doc/release_notes/0_24_3.md +12 -0
  38. data/doc/release_notes/0_24_4.md +18 -0
  39. data/doc/release_notes/0_24_5.md +6 -0
  40. data/doc/release_notes/0_24_6.md +5 -0
  41. data/doc/release_notes/0_24_7.md +10 -0
  42. data/doc/release_notes/1_0_0.md +60 -0
  43. data/doc/release_notes/1_0_1.md +5 -0
  44. data/doc/release_notes/1_0_2.md +7 -0
  45. data/doc/release_notes/1_1_0.md +32 -0
  46. data/doc/release_notes/1_1_1.md +17 -0
  47. data/doc/release_notes/1_1_2.md +12 -0
  48. data/doc/release_notes/1_1_3.md +18 -0
  49. data/doc/release_notes/1_1_4.md +6 -0
  50. data/doc/release_notes/1_1_5.md +12 -0
  51. data/doc/release_notes/1_2_0.md +49 -0
  52. data/doc/release_notes/1_2_1.md +6 -0
  53. data/doc/release_notes/1_2_2.md +10 -0
  54. data/doc/release_notes/1_2_3.md +16 -0
  55. data/doc/release_notes/1_2_4.md +8 -0
  56. data/doc/release_notes/1_2_5.md +7 -0
  57. data/doc/release_notes/1_2_6.md +13 -0
  58. data/doc/release_notes/1_3_0.md +18 -0
  59. data/doc/release_notes/1_3_1.md +17 -0
  60. data/lib/httpx/adapters/datadog.rb +215 -122
  61. data/lib/httpx/adapters/faraday.rb +145 -107
  62. data/lib/httpx/adapters/sentry.rb +26 -7
  63. data/lib/httpx/adapters/webmock.rb +34 -18
  64. data/lib/httpx/altsvc.rb +63 -26
  65. data/lib/httpx/base64.rb +27 -0
  66. data/lib/httpx/buffer.rb +12 -0
  67. data/lib/httpx/callbacks.rb +5 -3
  68. data/lib/httpx/chainable.rb +54 -39
  69. data/lib/httpx/connection/http1.rb +75 -44
  70. data/lib/httpx/connection/http2.rb +31 -38
  71. data/lib/httpx/connection.rb +287 -117
  72. data/lib/httpx/domain_name.rb +10 -13
  73. data/lib/httpx/errors.rb +52 -2
  74. data/lib/httpx/extensions.rb +24 -131
  75. data/lib/httpx/io/ssl.rb +83 -77
  76. data/lib/httpx/io/tcp.rb +48 -71
  77. data/lib/httpx/io/udp.rb +18 -52
  78. data/lib/httpx/io/unix.rb +10 -15
  79. data/lib/httpx/io.rb +3 -9
  80. data/lib/httpx/loggable.rb +4 -19
  81. data/lib/httpx/options.rb +176 -118
  82. data/lib/httpx/parser/http1.rb +4 -0
  83. data/lib/httpx/plugins/{authentication → auth}/basic.rb +1 -5
  84. data/lib/httpx/plugins/{authentication → auth}/digest.rb +14 -14
  85. data/lib/httpx/plugins/{authentication → auth}/ntlm.rb +1 -3
  86. data/lib/httpx/plugins/{authentication → auth}/socks5.rb +0 -2
  87. data/lib/httpx/plugins/auth.rb +25 -0
  88. data/lib/httpx/plugins/aws_sdk_authentication.rb +4 -3
  89. data/lib/httpx/plugins/aws_sigv4.rb +12 -9
  90. data/lib/httpx/plugins/basic_auth.rb +29 -0
  91. data/lib/httpx/plugins/brotli.rb +50 -0
  92. data/lib/httpx/plugins/callbacks.rb +91 -0
  93. data/lib/httpx/plugins/circuit_breaker/circuit.rb +100 -0
  94. data/lib/httpx/plugins/circuit_breaker/circuit_store.rb +53 -0
  95. data/lib/httpx/plugins/circuit_breaker.rb +148 -0
  96. data/lib/httpx/plugins/cookies/set_cookie_parser.rb +0 -2
  97. data/lib/httpx/plugins/cookies.rb +30 -17
  98. data/lib/httpx/plugins/{digest_authentication.rb → digest_auth.rb} +14 -12
  99. data/lib/httpx/plugins/expect.rb +21 -14
  100. data/lib/httpx/plugins/follow_redirects.rb +140 -41
  101. data/lib/httpx/plugins/grpc/call.rb +2 -3
  102. data/lib/httpx/plugins/grpc/grpc_encoding.rb +88 -0
  103. data/lib/httpx/plugins/grpc/message.rb +7 -37
  104. data/lib/httpx/plugins/grpc.rb +36 -29
  105. data/lib/httpx/plugins/h2c.rb +26 -19
  106. data/lib/httpx/plugins/internal_telemetry.rb +16 -0
  107. data/lib/httpx/plugins/{ntlm_authentication.rb → ntlm_auth.rb} +7 -5
  108. data/lib/httpx/plugins/oauth.rb +175 -0
  109. data/lib/httpx/plugins/persistent.rb +1 -1
  110. data/lib/httpx/plugins/proxy/http.rb +23 -13
  111. data/lib/httpx/plugins/proxy/socks4.rb +9 -7
  112. data/lib/httpx/plugins/proxy/socks5.rb +11 -9
  113. data/lib/httpx/plugins/proxy.rb +80 -61
  114. data/lib/httpx/plugins/push_promise.rb +1 -1
  115. data/lib/httpx/plugins/rate_limiter.rb +5 -1
  116. data/lib/httpx/plugins/response_cache/file_store.rb +40 -0
  117. data/lib/httpx/plugins/response_cache/store.rb +62 -25
  118. data/lib/httpx/plugins/response_cache.rb +105 -12
  119. data/lib/httpx/plugins/retries.rb +87 -17
  120. data/lib/httpx/plugins/ssrf_filter.rb +145 -0
  121. data/lib/httpx/plugins/stream.rb +27 -23
  122. data/lib/httpx/plugins/upgrade/h2.rb +4 -4
  123. data/lib/httpx/plugins/upgrade.rb +8 -10
  124. data/lib/httpx/plugins/webdav.rb +80 -0
  125. data/lib/httpx/pool/synch_pool.rb +93 -0
  126. data/lib/httpx/pool.rb +102 -27
  127. data/lib/httpx/punycode.rb +9 -291
  128. data/lib/httpx/request/body.rb +154 -0
  129. data/lib/httpx/request.rb +130 -146
  130. data/lib/httpx/resolver/https.rb +62 -27
  131. data/lib/httpx/resolver/multi.rb +9 -13
  132. data/lib/httpx/resolver/native.rb +192 -76
  133. data/lib/httpx/resolver/resolver.rb +34 -9
  134. data/lib/httpx/resolver/system.rb +16 -11
  135. data/lib/httpx/resolver.rb +38 -16
  136. data/lib/httpx/response/body.rb +242 -0
  137. data/lib/httpx/response/buffer.rb +96 -0
  138. data/lib/httpx/response.rb +159 -217
  139. data/lib/httpx/selector.rb +9 -4
  140. data/lib/httpx/session.rb +137 -89
  141. data/lib/httpx/session_extensions.rb +4 -1
  142. data/lib/httpx/timers.rb +34 -8
  143. data/lib/httpx/transcoder/body.rb +0 -2
  144. data/lib/httpx/transcoder/chunker.rb +0 -1
  145. data/lib/httpx/transcoder/deflate.rb +37 -0
  146. data/lib/httpx/transcoder/form.rb +52 -33
  147. data/lib/httpx/transcoder/gzip.rb +74 -0
  148. data/lib/httpx/transcoder/json.rb +21 -8
  149. data/lib/httpx/transcoder/multipart/decoder.rb +139 -0
  150. data/lib/httpx/{plugins → transcoder}/multipart/encoder.rb +4 -4
  151. data/lib/httpx/{plugins → transcoder}/multipart/mime_type_detector.rb +1 -1
  152. data/lib/httpx/{plugins → transcoder}/multipart/part.rb +3 -2
  153. data/lib/httpx/transcoder/multipart.rb +17 -0
  154. data/lib/httpx/transcoder/utils/body_reader.rb +46 -0
  155. data/lib/httpx/transcoder/utils/deflater.rb +72 -0
  156. data/lib/httpx/transcoder/utils/inflater.rb +19 -0
  157. data/lib/httpx/transcoder/xml.rb +52 -0
  158. data/lib/httpx/transcoder.rb +5 -6
  159. data/lib/httpx/utils.rb +36 -16
  160. data/lib/httpx/version.rb +1 -1
  161. data/lib/httpx.rb +12 -14
  162. data/sig/altsvc.rbs +33 -0
  163. data/sig/buffer.rbs +2 -1
  164. data/sig/callbacks.rbs +3 -3
  165. data/sig/chainable.rbs +11 -9
  166. data/sig/connection/http1.rbs +8 -7
  167. data/sig/connection/http2.rbs +19 -19
  168. data/sig/connection.rbs +64 -24
  169. data/sig/errors.rbs +22 -3
  170. data/sig/httpx.rbs +5 -4
  171. data/sig/io/ssl.rbs +27 -0
  172. data/sig/io/tcp.rbs +60 -0
  173. data/sig/io/udp.rbs +20 -0
  174. data/sig/io/unix.rbs +27 -0
  175. data/sig/io.rbs +6 -0
  176. data/sig/options.rbs +32 -22
  177. data/sig/parser/http1.rbs +1 -1
  178. data/sig/plugins/{authentication → auth}/basic.rbs +0 -2
  179. data/sig/plugins/{authentication → auth}/digest.rbs +2 -1
  180. data/sig/plugins/auth.rbs +13 -0
  181. data/sig/plugins/{basic_authentication.rbs → basic_auth.rbs} +2 -2
  182. data/sig/plugins/brotli.rbs +22 -0
  183. data/sig/plugins/callbacks.rbs +38 -0
  184. data/sig/plugins/circuit_breaker.rbs +71 -0
  185. data/sig/plugins/compression.rbs +7 -5
  186. data/sig/plugins/cookies/jar.rbs +2 -2
  187. data/sig/plugins/cookies.rbs +2 -0
  188. data/sig/plugins/{digest_authentication.rbs → digest_auth.rbs} +2 -2
  189. data/sig/plugins/follow_redirects.rbs +18 -4
  190. data/sig/plugins/grpc/call.rbs +19 -0
  191. data/sig/plugins/grpc/grpc_encoding.rbs +37 -0
  192. data/sig/plugins/grpc/message.rbs +17 -0
  193. data/sig/plugins/grpc.rbs +7 -32
  194. data/sig/plugins/h2c.rbs +1 -1
  195. data/sig/plugins/{ntlm_authentication.rbs → ntlm_auth.rbs} +2 -2
  196. data/sig/plugins/oauth.rbs +54 -0
  197. data/sig/plugins/proxy/http.rbs +3 -0
  198. data/sig/plugins/proxy/socks4.rbs +9 -6
  199. data/sig/plugins/proxy/socks5.rbs +10 -6
  200. data/sig/plugins/proxy/ssh.rbs +1 -1
  201. data/sig/plugins/proxy.rbs +13 -5
  202. data/sig/plugins/push_promise.rbs +3 -3
  203. data/sig/plugins/rate_limiter.rbs +1 -1
  204. data/sig/plugins/response_cache.rbs +36 -7
  205. data/sig/plugins/retries.rbs +30 -8
  206. data/sig/plugins/stream.rbs +24 -17
  207. data/sig/plugins/upgrade.rbs +5 -3
  208. data/sig/pool.rbs +10 -7
  209. data/sig/request/body.rbs +38 -0
  210. data/sig/request.rbs +15 -24
  211. data/sig/resolver/https.rbs +8 -3
  212. data/sig/resolver/native.rbs +17 -4
  213. data/sig/resolver/resolver.rbs +8 -6
  214. data/sig/resolver/system.rbs +2 -0
  215. data/sig/resolver.rbs +9 -5
  216. data/sig/response/body.rbs +53 -0
  217. data/sig/response/buffer.rbs +24 -0
  218. data/sig/response.rbs +24 -39
  219. data/sig/selector.rbs +1 -1
  220. data/sig/session.rbs +29 -18
  221. data/sig/timers.rbs +18 -8
  222. data/sig/transcoder/body.rbs +4 -3
  223. data/sig/transcoder/deflate.rbs +11 -0
  224. data/sig/transcoder/form.rbs +5 -3
  225. data/sig/transcoder/gzip.rbs +24 -0
  226. data/sig/transcoder/json.rbs +8 -3
  227. data/sig/{plugins → transcoder}/multipart.rbs +15 -19
  228. data/sig/transcoder/utils/body_reader.rbs +15 -0
  229. data/sig/transcoder/utils/deflater.rbs +29 -0
  230. data/sig/transcoder/utils/inflater.rbs +12 -0
  231. data/sig/transcoder/xml.rbs +22 -0
  232. data/sig/transcoder.rbs +24 -9
  233. data/sig/utils.rbs +8 -2
  234. metadata +163 -41
  235. data/lib/httpx/plugins/authentication.rb +0 -20
  236. data/lib/httpx/plugins/basic_authentication.rb +0 -30
  237. data/lib/httpx/plugins/compression/brotli.rb +0 -54
  238. data/lib/httpx/plugins/compression/deflate.rb +0 -49
  239. data/lib/httpx/plugins/compression/gzip.rb +0 -88
  240. data/lib/httpx/plugins/compression.rb +0 -164
  241. data/lib/httpx/plugins/multipart/decoder.rb +0 -187
  242. data/lib/httpx/plugins/multipart.rb +0 -84
  243. data/lib/httpx/registry.rb +0 -85
  244. data/sig/plugins/authentication.rbs +0 -11
  245. data/sig/plugins/compression/brotli.rbs +0 -21
  246. data/sig/plugins/compression/deflate.rbs +0 -17
  247. data/sig/plugins/compression/gzip.rbs +0 -29
  248. data/sig/registry.rbs +0 -12
  249. /data/sig/plugins/{authentication → auth}/ntlm.rbs +0 -0
  250. /data/sig/plugins/{authentication → auth}/socks5.rbs +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a5a31aeffa012bd1eea19c1e892c8669624de0d21c9cd8911ae025375f0b93fb
4
- data.tar.gz: 285707682eb2d1451106d28bc2d4a8ceb247d4237139c9e7d83bd5a0163b5a5c
3
+ metadata.gz: 0162427fe818aafee88a35a12a821cf4f1016701f4513835c91556a7e8579e9e
4
+ data.tar.gz: f559d77efcdbf0e557c28c9a012cb67f45a95de8f8c2fac521800679ea30dc31
5
5
  SHA512:
6
- metadata.gz: 6f2c50aa8895c6f07ed0acbca1b1171343da2b55bc838ae7f2a0f7a44300c101ea0020938946bf630b80ad6b81bed3cb54910b0734576b6e7c000e058497128c
7
- data.tar.gz: 83e19a86d841056821d9198c9a8e3e7b06ec354445289a1fd7d612d070b02b0a01aa9f45f5acdb0b35e4da413c2c3955646e5f55c5421db95879092a0a3aa377
6
+ metadata.gz: 1dd2fa825bdaef26137e8c5d993dcb426eab7897adc8570a343863e7842f3732948bdc827c58e1e361bb35b2c1d549b02d89051a592a836a51f39afb95a77263
7
+ data.tar.gz: 8a64f6fc512fd8fa60d7feeffff6447d3c8a4081fe6494873b4a527f425dad090ca84b810a2a91477b051a4dfeb0bbb12e0563ef37c20e8d5daab05f2a208138
data/LICENSE.txt CHANGED
@@ -189,51 +189,3 @@
189
189
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
190
190
  See the License for the specific language governing permissions and
191
191
  limitations under the License.
192
-
193
-
194
- * lib/httpx/domain_name.rb
195
-
196
- This file is derived from the implementation of punycode available at
197
- here:
198
-
199
- https://www.verisign.com/en_US/channel-resources/domain-registry-products/idn-sdks/index.xhtml
200
-
201
- Copyright (C) 2000-2002 Verisign Inc., All rights reserved.
202
-
203
- Redistribution and use in source and binary forms, with or
204
- without modification, are permitted provided that the following
205
- conditions are met:
206
-
207
- 1) Redistributions of source code must retain the above copyright
208
- notice, this list of conditions and the following disclaimer.
209
-
210
- 2) Redistributions in binary form must reproduce the above copyright
211
- notice, this list of conditions and the following disclaimer in
212
- the documentation and/or other materials provided with the
213
- distribution.
214
-
215
- 3) Neither the name of the VeriSign Inc. nor the names of its
216
- contributors may be used to endorse or promote products derived
217
- from this software without specific prior written permission.
218
-
219
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
220
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
221
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
222
- FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
223
- COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
224
- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
225
- BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
226
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
227
- AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
228
- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
229
- ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
230
- POSSIBILITY OF SUCH DAMAGE.
231
-
232
- This software is licensed under the BSD open source license. For more
233
- information visit www.opensource.org.
234
-
235
- Authors:
236
- John Colosi (VeriSign)
237
- Srikanth Veeramachaneni (VeriSign)
238
- Nagesh Chigurupati (Verisign)
239
- Praveen Srinivasan(Verisign)
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # HTTPX: A Ruby HTTP library for tomorrow... and beyond!
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/httpx.svg)](http://rubygems.org/gems/httpx)
4
- [![pipeline status](https://gitlab.com/honeyryderchuck/httpx/badges/master/pipeline.svg)](https://gitlab.com/honeyryderchuck/httpx/pipelines?page=1&scope=all&ref=master)
5
- [![coverage report](https://gitlab.com/honeyryderchuck/httpx/badges/master/coverage.svg?job=coverage)](https://honeyryderchuck.gitlab.io/httpx/coverage/#_AllFiles)
4
+ [![pipeline status](https://gitlab.com/os85/httpx/badges/master/pipeline.svg)](https://gitlab.com/os85/httpx/pipelines?page=1&scope=all&ref=master)
5
+ [![coverage report](https://gitlab.com/os85/httpx/badges/master/coverage.svg?job=coverage)](https://os85.gitlab.io/httpx/coverage/#_AllFiles)
6
6
 
7
7
  HTTPX is an HTTP client library for the Ruby programming language.
8
8
 
@@ -19,13 +19,17 @@ And also:
19
19
 
20
20
  * Compression (gzip, deflate, brotli)
21
21
  * Streaming Requests
22
- * Authentication (Basic Auth, Digest Auth)
22
+ * Auth (Basic Auth, Digest Auth, NTLM)
23
23
  * Expect 100-continue
24
24
  * Multipart Requests
25
- * Cookies
25
+ * Advanced Cookie handling
26
26
  * HTTP/2 Server Push
27
- * H2C Upgrade
27
+ * HTTP/1.1 Upgrade (support for "h2c", "h2")
28
28
  * Automatic follow redirects
29
+ * GRPC
30
+ * WebDAV
31
+ * Circuit Breaker
32
+ * HTTP-based response cache
29
33
  * International Domain Names
30
34
 
31
35
  ## How
@@ -36,7 +40,14 @@ Here are some simple examples:
36
40
  HTTPX.get("https://nghttp2.org").to_s #=> "<!DOCT...."
37
41
  ```
38
42
 
39
- And that's the simplest one there is.
43
+ And that's the simplest one there is. But you can also do:
44
+
45
+ ```ruby
46
+ HTTPX.post("http://example.com", form: { user: "john", password: "pass" })
47
+
48
+ http = HTTPX.with(headers: { "x-my-name" => "joe" })
49
+ http.patch("http://example.com/file", body: File.open("path/to/file")) # request body is streamed
50
+ ```
40
51
 
41
52
  If you want to do some more things with the response, you can get an `HTTPX::Response`:
42
53
 
@@ -73,76 +84,74 @@ and then just require it in your program:
73
84
  require "httpx"
74
85
  ```
75
86
 
76
- ## Why Should I care?
87
+ ## What makes it the best ruby HTTP client
77
88
 
78
- In Ruby, HTTP client implementations are a known cheap commodity. Why this one?
79
89
 
80
- ### Concurrency
90
+ ### Concurrency, HTTP/2 support
81
91
 
82
- This library supports HTTP/2 seamlessly (which means, if the request is secure, and the server support ALPN negotiation AND HTTP/2, the request will be made through HTTP/2). If you pass multiple URIs, and they can utilize the same connection, they will run concurrently in it.
92
+ `httpx` supports HTTP/2 (for "https" requests, it'll automatically do ALPN negotiation). However if the server supports HTTP/1.1, it will use HTTP pipelining, falling back to 1 request at a time if the server doesn't support it either (and it'll use Keep-Alive connections, unless the server does not support).
83
93
 
84
- However if the server supports HTTP/1.1, it will try to use HTTP pipelining, falling back to 1 request at a time if the server doesn't support it (if the server support Keep-Alive connections, it will reuse the same connection).
94
+ If you passed multiple URIs, it'll perform all of the requests concurrently, by mulitplexing on the necessary sockets (and it'll batch requests to the same socket when the origin is the same):
95
+
96
+ ```ruby
97
+ HTTPX.get(
98
+ "https://news.ycombinator.com/news",
99
+ "https://news.ycombinator.com/news?p=2",
100
+ "https://google.com/q=me"
101
+ ) # first two requests will be multiplexed on the same socket.
102
+ ```
85
103
 
86
104
  ### Clean API
87
105
 
88
106
  `httpx` builds all functions around the `HTTPX` module, so that all calls can compose of each other. Here are a few examples:
89
107
 
90
108
  ```ruby
91
- response = HTTPX.get("https://www.google.com")
92
- response = HTTPX.post("https://www.nghttp2.org/httpbin/post", params: {name: "John", age: "22"})
93
- response = HTTPX.plugin(:basic_authentication)
94
- .basic_authentication("user", "pass")
109
+ response = HTTPX.get("https://www.google.com", params: { q: "me" })
110
+ response = HTTPX.post("https://www.nghttp2.org/httpbin/post", form: { name: "John", age: "22" })
111
+ response = HTTPX.plugin(:basic_auth)
112
+ .basic_auth("user", "pass")
95
113
  .get("https://www.google.com")
114
+
115
+ # more complex client objects can be cached, and are thread-safe
116
+ http = HTTPX.plugin(:expect).with(headers: { "x-pvt-token" => "TOKEN" })
117
+ http.get("https://example.com") # the above options will apply
118
+ http.post("https://example2.com", form: { name: "John", age: "22" }) # same, plus the form POST body
96
119
  ```
97
120
 
98
121
  ### Lightweight
99
122
 
100
- It ships with a plugin system similar to the ones used by [sequel](https://github.com/jeremyevans/sequel), [roda](https://github.com/jeremyevans/roda) or [shrine](https://github.com/janko-m/shrine).
123
+ It ships with most features published as a plugin, making vanilla `httpx` lightweight and dependency-free, while allowing you to "pay for what you use"
101
124
 
102
- It means that it loads the bare minimum to perform requests, and the user has to explicitly load the plugins, in order to get the features he/she needs.
125
+ The plugin system is similar to the ones used by [sequel](https://github.com/jeremyevans/sequel), [roda](https://github.com/jeremyevans/roda) or [shrine](https://github.com/shrinerb/shrine).
103
126
 
104
- It also means that it ships with the minimum amount of dependencies.
127
+ ### Advanced DNS features
105
128
 
106
- ### DNS-over-HTTPS
129
+ `HTTPX` ships with custom DNS resolver implementations, including a native Happy Eyeballs resolver implementation, and a DNS-over-HTTPS resolver.
107
130
 
108
- `HTTPX` ships with custom DNS resolver implementations, including a DNS-over-HTTPS resolver.
131
+ ## User-driven test suite
109
132
 
110
- ## Easy to test
111
-
112
- The test suite runs against [httpbin proxied over nghttp2](https://nghttp2.org/httpbin/), so there are no mocking/stubbing false positives. The test suite uses [minitest](https://github.com/seattlerb/minitest), but its matchers usage is (almost) limited to `#assert` (`assert` is all you need).
133
+ The test suite runs against [httpbin proxied over nghttp2](https://nghttp2.org/httpbin/), so actual requests are performed during tests.
113
134
 
114
135
  ## Supported Rubies
115
136
 
116
- All Rubies greater or equal to 2.1, and always latest JRuby and Truffleruby.
137
+ All Rubies greater or equal to 2.7, and always latest JRuby and Truffleruby.
117
138
 
118
- **Note**: This gem is tested against all latest patch versions, i.e. if you're using 2.2.0 and you experience some issue, please test it against 2.2.10 (latest patch version of 2.2) before creating an issue.
139
+ **Note**: This gem is tested against all latest patch versions, i.e. if you're using 3.3.0 and you experience some issue, please test it against 3.3.$latest before creating an issue.
119
140
 
120
141
  ## Resources
121
- | | |
122
- | ------------- | --------------------------------------------------- |
123
- | Website | https://honeyryderchuck.gitlab.io/httpx/ |
124
- | Documentation | https://honeyryderchuck.gitlab.io/httpx/rdoc/ |
125
- | Wiki | https://gitlab.com/honeyryderchuck/httpx/wikis/home |
126
- | CI | https://gitlab.com/honeyryderchuck/httpx/pipelines |
142
+ | | |
143
+ | ------------- | ------------------------------------------------------ |
144
+ | Website | https://honeyryderchuck.gitlab.io/httpx/ |
145
+ | Documentation | https://honeyryderchuck.gitlab.io/httpx/rdoc/ |
146
+ | Wiki | https://honeyryderchuck.gitlab.io/httpx/wiki/home.html |
147
+ | CI | https://gitlab.com/os85/httpx/pipelines |
148
+ | Rubygems | https://rubygems.org/gems/httpx |
127
149
 
128
150
  ## Caveats
129
151
 
130
- ### ALPN support
131
-
132
- `HTTPS` TLS backend is ruby's own `openssl` gem.
133
-
134
- If your requirement is to run requests over HTTP/2 and TLS, make sure you run a version of the gem which compiles OpenSSL 1.0.2 (Ruby 2.3 and higher are guaranteed to).
135
-
136
- In order to use HTTP/2 under JRuby, [check this link](https://gitlab.com/honeyryderchuck/httpx/-/wikis/JRuby-Truffleruby-Other-Rubies) to know what to do.
137
-
138
- ### Known bugs
139
-
140
- * Doesn't work with ruby 2.4.0 for Windows (see [#36](https://gitlab.com/honeyryderchuck/httpx/issues/36)).
141
- * Using `total_timeout` along with the `:persistent` plugin [does not work as you might expect](https://gitlab.com/honeyryderchuck/httpx/-/wikis/Timeouts#total_timeout).
142
-
143
152
  ## Versioning Policy
144
153
 
145
- Although 0.x software, `httpx` is considered API-stable and production-ready, i.e. current API or options may be subject to deprecation and emit log warnings, but can only effectively be removed in a major version change.
154
+ `httpx` follows Semantic Versioning.
146
155
 
147
156
  ## Contributing
148
157
 
@@ -15,7 +15,7 @@ http.get(stream_api_endpoint, stream: true).each_line do |line|
15
15
  end
16
16
  ```
17
17
 
18
- https://gitlab.com/honeyryderchuck/httpx/-/wikis/Stream
18
+ https://gitlab.com/os85/httpx/-/wikis/Stream
19
19
 
20
20
  ### Rate Limiter
21
21
 
@@ -27,7 +27,7 @@ HTTPX.plugin(:rate_limiter).get(rate_limited_api_endpoint)
27
27
  # waits 3 seconds before retrying
28
28
  ```
29
29
 
30
- https://gitlab.com/honeyryderchuck/httpx/-/wikis/Rate-Limiter
30
+ https://gitlab.com/os85/httpx/-/wikis/Rate-Limiter
31
31
 
32
32
  ### Ruby 3
33
33
 
@@ -21,7 +21,7 @@ stub_http_request(:get, "https://www.google.com").and_return(status: 200, body:
21
21
 
22
22
  ```
23
23
 
24
- Read more about it in the [webmock integration documentation](https://honeyryderchuck.gitlab.io/httpx/wiki/Webmock-Adapter).
24
+ Read more about it in the [webmock integration documentation](https://os85.gitlab.io/httpx/wiki/Webmock-Adapter).
25
25
 
26
26
  ### Datadog Adapter
27
27
 
@@ -40,7 +40,7 @@ A trace will be emitted for every request, so this should be an interesting visu
40
40
 
41
41
  Customization options and traces are similar to what [the net-http adapter provides](https://docs.datadoghq.com/tracing/setup_overview/setup/ruby/#nethttp).
42
42
 
43
- Read more about it in the [datadog integration documentation](https://honeyryderchuck.gitlab.io/httpx/wiki/Datadog-Adapter).
43
+ Read more about it in the [datadog integration documentation](https://os85.gitlab.io/httpx/wiki/Datadog-Adapter).
44
44
 
45
45
  ## Improvements
46
46
 
@@ -52,7 +52,7 @@ Read more about it in the [datadog integration documentation](https://honeyryder
52
52
  HTTPX.plugin(:multipart).post(uri, form: {file: File.new("path/to/file")})
53
53
  ```
54
54
 
55
- Read more about it in the [multipart plugin documentation](https://honeyryderchuck.gitlab.io/httpx/wiki/Multipart-Uploads), including also about why this was made.
55
+ Read more about it in the [multipart plugin documentation](https://os85.gitlab.io/httpx/wiki/Multipart-Uploads), including also about why this was made.
56
56
 
57
57
  ### Expect Plugin
58
58
 
@@ -72,5 +72,3 @@ response = session.get(proxy_ip, headers: { "host" => upstream_hostname }, ssl:
72
72
  ## Bugfixes
73
73
 
74
74
  A default 5 second timeout is in-place when using the DNS `:system` resolver, as it was found out that. when using the `resolv` library, the DNS query will not be retried otherwise. You can change this setting py passing `resolver_options: { timeouts: ANOTHER_TIMEOUT}`. In the future, this may become another timeout option, however.
75
-
76
-
@@ -6,19 +6,19 @@
6
6
 
7
7
  A new plugin, `:aws_sigv4`, is now shipped with `httpx`. It implements the [AWS Signature Version 4 request signing process](https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html), a well documented way of authenticating requests to AWS services, which has since been adopted by other cloud providers, such as Google Cloud Storage.
8
8
 
9
- See how to use it here: https://gitlab.com/honeyryderchuck/httpx/-/wikis/AWS-Sigv4#sessionaws_sigv4_authentication
9
+ See how to use it here: https://gitlab.com/os85/httpx/-/wikis/AWS-Sigv4#sessionaws_sigv4_authentication
10
10
 
11
11
  For convenience, there's a derivative plugin, `:aws_sdk_authentication`, which builds on top of `:aws_sigv4`, and integrates with the `aws-sdk-core` gem, maintained by AWS, to resolve the authentication credentials (p.ex. if you support ephemeral access keys).
12
12
 
13
- See how to use it here: https://gitlab.com/honeyryderchuck/httpx/-/wikis/AWS-Sigv4#sessionaws_sdk_authentication
13
+ See how to use it here: https://gitlab.com/os85/httpx/-/wikis/AWS-Sigv4#sessionaws_sdk_authentication
14
14
 
15
- Other FAQ: https://gitlab.com/honeyryderchuck/httpx/-/wikis/AWS-Sigv4#faqs
15
+ Other FAQ: https://gitlab.com/os85/httpx/-/wikis/AWS-Sigv4#faqs
16
16
 
17
17
  ### HTTP/2 support for JRuby
18
18
 
19
19
  `jruby-openssl` doesn't support ALPN protocol negotiation, nor are there plans to implement, which limited the seamless HTTP/2 usage in `httpx`. A new connection adapter was therefore added specifically for JRuby, where ssl/tls connections will be handled using ffi-based openssl bindings, provided you bundle `ffi-compiler` and `concurrent-ruby`, and install a TLS/1.2-compatible `openssl` package.
20
20
 
21
- See how to use it here: https://gitlab.com/honeyryderchuck/httpx/-/wikis/JRuby-Truffleruby-Other-Rubies#http2
21
+ See how to use it here: https://gitlab.com/os85/httpx/-/wikis/JRuby-Truffleruby-Other-Rubies#http2
22
22
 
23
23
  ## Improvements
24
24
 
@@ -52,4 +52,4 @@ They all contributed to a massive performance improvement, itself reflected in t
52
52
  * Fixed TCP handshake Errno::INPROGRESS handling inside TLS connnections, which was causing the process to hang in a high handshake contention scenario;
53
53
  * Do not call the event loop if there's nothing to listen on (the DoH resolver was being listened on even if there was nothing to be request);
54
54
  * Fixed double event registry for DoH resolvers;
55
- *
55
+ *
@@ -4,9 +4,9 @@
4
4
 
5
5
  ### Upgrade plugin
6
6
 
7
- A new plugin, `:upgrade`, is now available. This plugin allows one to "hook" on HTTP/1.1's protocol upgrade mechanism (see: https://developer.mozilla.org/en-US/docs/Web/HTTP/Protocol_upgrade_mechanism), which is the mechanism that browsers use to initiate websockets (there is an example of how to use `httpx` to start a websocket client connection [in the tests](https://gitlab.com/honeyryderchuck/httpx/-/blob/master/test/support/requests/plugins/upgrade.rb))
7
+ A new plugin, `:upgrade`, is now available. This plugin allows one to "hook" on HTTP/1.1's protocol upgrade mechanism (see: https://developer.mozilla.org/en-US/docs/Web/HTTP/Protocol_upgrade_mechanism), which is the mechanism that browsers use to initiate websockets (there is an example of how to use `httpx` to start a websocket client connection [in the tests](https://gitlab.com/os85/httpx/-/blob/master/test/support/requests/plugins/upgrade.rb))
8
8
 
9
- You can read more about the `:upgrade` plugin in the [wiki](https://honeyryderchuck.gitlab.io/httpx/wiki/Connection-Upgrade).
9
+ You can read more about the `:upgrade` plugin in the [wiki](https://os85.gitlab.io/httpx/wiki/Connection-Upgrade).
10
10
 
11
11
  It's the basis of two plugins:
12
12
 
@@ -14,13 +14,13 @@ It's the basis of two plugins:
14
14
 
15
15
  This plugin was been rewritten on top of the `:upgrade` plugin, and handles upgrading a plaintext (non-"https") HTTP/1.1 connection, into an HTTP/2 connection.
16
16
 
17
- https://honeyryderchuck.gitlab.io/httpx/wiki/Connection-Upgrade#h2c
17
+ https://os85.gitlab.io/httpx/wiki/Connection-Upgrade#h2c
18
18
 
19
19
  #### `:upgrade/h2`
20
20
 
21
21
  This plugin handles when a server responds to a request with an `Upgrade: h2` header, does the following requests to the same origin via HTTP/2 prior knowledge (bypassing the necessity for ALPN negotiation, which is the whole point of the feature).
22
22
 
23
- https://honeyryderchuck.gitlab.io/httpx/wiki/Connection-Upgrade#h2
23
+ https://os85.gitlab.io/httpx/wiki/Connection-Upgrade#h2
24
24
 
25
25
  ### `:addresses` option
26
26
 
@@ -34,7 +34,7 @@ HTTPX.get("http://example.com", addresses: %w[172.5.3.1 172.5.3.2]))
34
34
  You should also use it to connect to HTTP servers bound to a UNIX socket, in which case you'll have to provide a path:
35
35
 
36
36
  ```ruby
37
- HTTPX.get("http://example.com", addresses: %w[/path/to/usocket]))
37
+ HTTPX.get("http://example.com", transport: "unix", addresses: %w[/path/to/usocket]))
38
38
  ```
39
39
 
40
40
  The `:transport_options` are therefore deprecated, and will be moved in a major version.
@@ -17,7 +17,7 @@ helloworld_svc = helloworld_stub.rpc(:SayHello, HelloRequest, HelloReply)
17
17
  result = helloworld_svc.say_hello(HelloRequest.new(name: "Jack")) #=> HelloReply: "Hello Jack"
18
18
  ```
19
19
 
20
- You can read more about the `:grpc` plugin in the [wiki](https://honeyryderchuck.gitlab.io/httpx/wiki/GRPC).
20
+ You can read more about the `:grpc` plugin in the [wiki](https://os85.gitlab.io/httpx/wiki/GRPC).
21
21
 
22
22
  ### :origin
23
23
 
@@ -37,7 +37,7 @@ httpbin.get("/httpbin/get") #=> #<Response:5420 HTTP/2.0 @status=200 ....
37
37
  * setting an unexpected option will now raise an `HTTPX::Error` with an helpful message, instead of a confusing `NoMethodError`:
38
38
 
39
39
  ```ruby
40
- HTTPX.with(foo: "bar")
40
+ HTTPX.with(foo: "bar")
41
41
  # before
42
42
  #=> NoMethodError
43
43
  # after
@@ -16,7 +16,7 @@ response.body.to_s #=> ""
16
16
 
17
17
  The justification for this behaviour probably had to do with avoiding keeping huge payloads around, but it got a bit lost in git history. It became a feature, not a bug.
18
18
 
19
- However, I got an [issue report](https://gitlab.com/honeyryderchuck/httpx/-/issues/143) that made me change my mind about this behaviour (tl;dr: it broke pattern matching when matching against response bodies more than once).
19
+ However, I got an [issue report](https://gitlab.com/os85/httpx/-/issues/143) that made me change my mind about this behaviour (tl;dr: it broke pattern matching when matching against response bodies more than once).
20
20
 
21
21
  So now, you can call `.to_s` how many times you want!
22
22
 
@@ -62,7 +62,7 @@ stub.get_feature(# ...
62
62
 
63
63
  ### OptionsMethods for plugins
64
64
 
65
- https://gitlab.com/honeyryderchuck/httpx/-/wikis/Custom-Plugins
65
+ https://gitlab.com/os85/httpx/-/wikis/Custom-Plugins
66
66
 
67
67
  You can now define an `OptionsMethods` module under your custom plugin to define your own methods. The tl;dr is, that, given the following module below, a new `:bar` option will be available (and the method will be used to set it):
68
68
 
@@ -80,7 +80,7 @@ HTTPX.plugin(CustomPlugin).with(bar: 2)
80
80
 
81
81
  The behaviour of the cookies jar from the `:cookies` plugin was a bit unpredictable in certain conditions, for instance if a "Cookie" header would be passed directly via `.with(headers: {"Cookie" => "a=1"})` and there'd be a value for it already (in same cases, it'd be fully ignored). This would even get worse, if the session had a jar, and a specific set of cookies would be passed to a request(i.e.: `session_with_cookies.get("http://url.get", headers: {"Cookies" => "..."}`).
82
82
 
83
- The behaviour was fixed, and is now specced under https://gitlab.com/honeyryderchuck/httpx/-/blob/master/test/support/requests/plugins/cookies.rb .
83
+ The behaviour was fixed, and is now specced under https://gitlab.com/os85/httpx/-/blob/master/test/support/requests/plugins/cookies.rb .
84
84
 
85
85
  ## Bugfixes
86
86
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  ### Response mime type decoders (#json, #form)
6
6
 
7
- https://gitlab.com/honeyryderchuck/httpx/-/wikis/Response-Handling#response-decoding
7
+ https://gitlab.com/os85/httpx/-/wikis/Response-Handling#response-decoding
8
8
 
9
9
  Two new methods, `#json` and `#form`, were added to `HTTPX::Response`. As the name implies, they'll decode the raw payload into ruby objects you can work with.
10
10
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  ### Response Cache
6
6
 
7
- https://gitlab.com/honeyryderchuck/httpx/-/wikis/Response-Cache
7
+ https://gitlab.com/os85/httpx/-/wikis/Response-Cache
8
8
 
9
9
  The `:response_cache` plugin handles transparent usage of HTTP caching and conditional requests to improve performance and bandwidth usage.
10
10
 
@@ -22,7 +22,7 @@ r1.body == r2.body #=> true
22
22
 
23
23
  On the `:retries` plugin, jitter calculation is now applied to the value in seconds defined by user after which a request should be retried (i.e. if `:retry_after` option is set to `2`, the retry interval may be `1.5422312` seconds, for example). This is important to avoid cases of synchronized "thundering herd", where server rejects requests, but they all get retried at the same time because the retry interval is exactly the same.
24
24
 
25
- You can override the jitter calculation function by using the [:retry_jitter](https://gitlab.com/honeyryderchuck/httpx/-/wikis/Retries#retry_jitter) option:
25
+ You can override the jitter calculation function by using the [:retry_jitter](https://gitlab.com/os85/httpx/-/wikis/Retries#retry_jitter) option:
26
26
 
27
27
  ```ruby
28
28
  HTTPX.plugin(:retries, retry_after: 2, retry_jitter: ->(interval) { interval + rand }) # interval is 3
@@ -44,7 +44,7 @@ end
44
44
 
45
45
  ## Improvements
46
46
 
47
- * `webmock` adapter: added support for "stub_http_request#to_timeout" (https://gitlab.com/honeyryderchuck/httpx/-/merge_requests/165).
47
+ * `webmock` adapter: added support for "stub_http_request#to_timeout" (https://gitlab.com/os85/httpx/-/merge_requests/165).
48
48
 
49
49
  ## timers not a dependency
50
50
 
@@ -57,7 +57,7 @@ The functionality provided by the `timers` gem was replaced by a simpler custom
57
57
 
58
58
  ## Bugfixes
59
59
 
60
- * Fixed Error class declaration on response decoders when mime type is invalid (https://gitlab.com/honeyryderchuck/httpx/-/merge_requests/166).
60
+ * Fixed Error class declaration on response decoders when mime type is invalid (https://gitlab.com/os85/httpx/-/merge_requests/166).
61
61
  * `ErrorResponse#to_s` now removes ANSI escape sequences from error backtraces.
62
62
  * Persistent connections were kept around both in the pool and in the selector; the first is necessary, but the second caused busy loop scenarios all over; they are now removed when no requests are being handled.
63
63
  * Connections which failed connection handshake were removed from the pool, but not from the selector list, causing busy loop scenarios in a few cases; this has been fixed.
@@ -7,4 +7,4 @@
7
7
 
8
8
  ## Chore
9
9
 
10
- The quirk of using the `:persistent` plugin with `:total_timeout` has been documented: https://gitlab.com/honeyryderchuck/httpx/-/wikis/Timeouts#total_timeout.
10
+ The quirk of using the `:persistent` plugin with `:total_timeout` has been documented: https://gitlab.com/os85/httpx/-/wikis/Timeouts#total_timeout.
@@ -28,7 +28,7 @@ Connection coalescing has also been enabled for proxied connections (also `CONNE
28
28
 
29
29
  ### curl-to-httpx
30
30
 
31
- widget in [project website](https://honeyryderchuck.gitlab.io/httpx/) to turn curl commands into the equivalent `httpx` code.
31
+ widget in [project website](https://os85.gitlab.io/httpx/) to turn curl commands into the equivalent `httpx` code.
32
32
 
33
33
  ## Bugfixes
34
34
 
@@ -1,4 +1,4 @@
1
- # 0.19.7
1
+ # 0.19.8
2
2
 
3
3
  ## Bugfixes
4
4
 
@@ -1,10 +1,10 @@
1
- # 0.19.0
1
+ # 0.20.0
2
2
 
3
3
  ## Features
4
4
 
5
5
  ### Sentry integration
6
6
 
7
- Documentation: https://gitlab.com/honeyryderchuck/httpx/-/wikis/Sentry-Adapter
7
+ Documentation: https://gitlab.com/os85/httpx/-/wikis/Sentry-Adapter
8
8
 
9
9
  `httpx` ships with integration for `sentry-ruby` to provide HTTP request specific breadcrumbs and tracing. It can be enabled via:
10
10
 
@@ -0,0 +1,5 @@
1
+ # 0.20.1
2
+
3
+ ## Bugfixes
4
+
5
+ * bugfix for unregistering connections when timing out on DNS resolving; this wasn't happening, leaving a few cases where requests to the same domain timing out on resolution would hang on the second request.
@@ -0,0 +1,7 @@
1
+ # 0.20.2
2
+
3
+ ## Bugfixes
4
+
5
+ * fix for selector timeout errors closing all connections and ignoring resolvers.
6
+
7
+ Timeout errors on select were being propagated to all pooled connections, although not all of them were being selected on, and not all of them having timed out. plus, resolver timeouts were doing the same, making connections fail with connection timeout error, rather than resolve timeout error. A patch was implemented, where the selector now yields an error to the selected connections, rather than plain raising exception.
@@ -0,0 +1,6 @@
1
+ # 0.20.3
2
+
3
+ ## Bugfixes
4
+
5
+ * DoH resolver wasn't working for non-absolute (the large majority) of domains since v0.19.
6
+ * Allowing a single IP string to be passed to the resolver option `:nameserver` (just like the `resolv` library does), besides the already supported list of IPs.
@@ -0,0 +1,17 @@
1
+ # 0.20.4
2
+
3
+ ## Improvements
4
+
5
+ The `:response_cache` plugin is now more compliant with how the RFC 2616 defines which behaviour caches shall have:
6
+
7
+ * it caches only responses with one of the following status codes: 200, 203, 300, 301, 410.
8
+ * it discards cached responses which become stale.
9
+ * it supports "cache-control" header directives to decided when to cache, to store, what the response "age" is.
10
+ * it can cache more than one response for the same request, provided that the request presents different header values for the headers declared in the "vary" response header (previously, it was only caching the first response, and discarding the remainder).
11
+
12
+
13
+
14
+ ## Bugfixes
15
+
16
+ * fixed DNS resolution bug which caused a loop when a failed connection attempt would cause a new DNS request to be triggered for the same domain, filling up and giving preference to the very IP which failed the attempt.
17
+ * response_cache: request verb is now taken into account, not causing HEAD/GET confusion for the same URL.
@@ -0,0 +1,3 @@
1
+ # 0.20.5
2
+
3
+ The `intersect?` refinement introduced in the previous version had a wrong variable name.
@@ -0,0 +1,96 @@
1
+ # 0.21.0
2
+
3
+ ## Features
4
+
5
+ ### `:write_timeout`, `:read_timeout` and `:request_timeout`
6
+
7
+ https://gitlab.com/os85/httpx/-/wikis/Timeouts
8
+
9
+ The following timeouts are now supported:
10
+
11
+ * `:write_timeout`: total time (in seconds) to write a request to the server;
12
+ * `:read_timeout`: total time (in seconds) to read a response from the server;
13
+ * `:request_timeout`: tracks both of the above (time to write the request and read a response);
14
+
15
+ ```ruby
16
+ HTTPX.with(timeout: { request_timeout: 60}).get(...
17
+ ```
18
+
19
+ Just like `:connect_timeout`, the new timeouts are deadline-oriented, rather than op-oriented, meaning that they do not reset on each socket operation (as most ruby HTTP clients do).
20
+
21
+ None of them has a default value, in order not to break integrations, but that'll change in a future v1, where they'll become the default timeouts.
22
+
23
+ ### Circuit Breaker plugin
24
+
25
+ https://gitlab.com/os85/httpx/-/wikis/Circuit-Breaker
26
+
27
+ The `:circuit_breaker` plugin wraps around errors happening when performing HTTP requests, and support options for setting maximum number of attempts before circuit opens (`:circuit_breaker_max_attempts`), period after which attempts should be reset (`:circuit_breaker_reset_attempts_in`), timespan until circuit half-opens (`circuit_breaker_break_in`), respective half-open drip rate (`:circuit_breaker_half_open_drip_rate`), and a callback to do your own check on whether a response has failed, in case you want HTTP level errors to be marked as failed attempts (`:circuit_breaker_break_on`).
28
+
29
+ Read the wiki for more info about the defaults.
30
+
31
+ ```ruby
32
+ http = HTTPX.plugin(:circuit_breaker)
33
+ # that's it!
34
+ http.get(...
35
+ ```
36
+
37
+ ### WebDAV plugin
38
+
39
+ https://gitlab.com/os85/httpx/-/wikis/WebDav
40
+
41
+ The `:webdav` introduces some "convenience" methods to perform common WebDAV operations.
42
+
43
+ ```ruby
44
+ webdav = HTTPX.plugin(:webdav, origin: "http://webdav-server")
45
+ .plugin(:digest_authentication).digest_auth("user", "pass")
46
+
47
+ res = webdav.put("/file.html", body: "this is the file body")
48
+ res = webdav.copy("/file.html", "/newdir/copy.html")
49
+ # ...
50
+ ```
51
+
52
+ ### XML transcoder, `:xml` option and `response.xml`
53
+
54
+ A new transcoder was added fot the XML mime type, which requires `"nokogiri"` to be installed. It can both serialize Nokogiri nodes in a request, and parse response content into nokogiri nodes:
55
+
56
+ ```ruby
57
+ response = HTTPX.post("https://xml-server.com", xml: Nokogiri::XML("<xml ..."))
58
+ response.xml #=> #(Document:0x16e4 { name = "document", children = ...
59
+ ```
60
+
61
+ ## Improvements
62
+
63
+ ### `:proxy` plugin: `:no_proxy` option
64
+
65
+ Support was added, in the `:proxy` plugin, to declare domains, either via regexp patterns, or strings, for which requests should bypass the proxy.
66
+
67
+ ```ruby
68
+ http = HTTPX.plugin(:proxy).with_proxy(
69
+ uri: "http://10.10.0.1:51432",
70
+ no_proxy: ["gitlab.local", /*.google.com/]
71
+ )
72
+ http.get("https://duckduckgo.com/?q=httpx") #=> proxied
73
+ http.get("https://google.com/?q=httpx") #=> not proxied
74
+ http.get("https://gitlab.com") #=> proxied
75
+ http.get("https://gitlab.local") #=> not proxied
76
+ ```
77
+
78
+ ### OOTB support for other JSON libraries
79
+
80
+ If one of `multi_json`, `oj` or `yajl` is available, all `httpx` operations doing JSON parsing or dumping will use it (the `json` standard library will be used otherwise).
81
+
82
+ ```ruby
83
+ require "oj"
84
+ require "httpx"
85
+
86
+ response = HTTPX.post("https://somedomain.json", json: { "foo" => "bar" }) # will use "oj"
87
+ puts response.json # will use "oj"
88
+ ```
89
+
90
+ ## Bugfixes
91
+
92
+ * `:expect` plugin: `:expect_timeout` can accept floats (not just integers).
93
+
94
+ ## Chore
95
+
96
+ * DoH `:https` resolver: support was removed for the "application/dns-json" mime-type (it was only supported in practice by the Google DoH resolver, which has since added support for the standardized "application/dns-message").