httpx 0.21.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (229) 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 +4 -4
  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_20_0.md +1 -1
  15. data/doc/release_notes/0_21_0.md +7 -5
  16. data/doc/release_notes/0_21_1.md +12 -0
  17. data/doc/release_notes/0_22_0.md +13 -0
  18. data/doc/release_notes/0_22_1.md +11 -0
  19. data/doc/release_notes/0_22_2.md +5 -0
  20. data/doc/release_notes/0_22_3.md +55 -0
  21. data/doc/release_notes/0_22_4.md +6 -0
  22. data/doc/release_notes/0_22_5.md +6 -0
  23. data/doc/release_notes/0_23_0.md +42 -0
  24. data/doc/release_notes/0_23_1.md +5 -0
  25. data/doc/release_notes/0_23_2.md +5 -0
  26. data/doc/release_notes/0_23_3.md +6 -0
  27. data/doc/release_notes/0_23_4.md +5 -0
  28. data/doc/release_notes/0_24_0.md +48 -0
  29. data/doc/release_notes/0_24_1.md +12 -0
  30. data/doc/release_notes/0_24_2.md +12 -0
  31. data/doc/release_notes/0_24_3.md +12 -0
  32. data/doc/release_notes/0_24_4.md +18 -0
  33. data/doc/release_notes/0_24_5.md +6 -0
  34. data/doc/release_notes/0_24_6.md +5 -0
  35. data/doc/release_notes/0_24_7.md +10 -0
  36. data/doc/release_notes/1_0_0.md +60 -0
  37. data/doc/release_notes/1_0_1.md +5 -0
  38. data/doc/release_notes/1_0_2.md +7 -0
  39. data/doc/release_notes/1_1_0.md +32 -0
  40. data/doc/release_notes/1_1_1.md +17 -0
  41. data/doc/release_notes/1_1_2.md +12 -0
  42. data/doc/release_notes/1_1_3.md +18 -0
  43. data/doc/release_notes/1_1_4.md +6 -0
  44. data/doc/release_notes/1_1_5.md +12 -0
  45. data/doc/release_notes/1_2_0.md +49 -0
  46. data/doc/release_notes/1_2_1.md +6 -0
  47. data/lib/httpx/adapters/datadog.rb +100 -106
  48. data/lib/httpx/adapters/faraday.rb +143 -107
  49. data/lib/httpx/adapters/sentry.rb +26 -7
  50. data/lib/httpx/adapters/webmock.rb +33 -17
  51. data/lib/httpx/altsvc.rb +61 -24
  52. data/lib/httpx/base64.rb +27 -0
  53. data/lib/httpx/buffer.rb +12 -0
  54. data/lib/httpx/callbacks.rb +5 -3
  55. data/lib/httpx/chainable.rb +54 -39
  56. data/lib/httpx/connection/http1.rb +62 -37
  57. data/lib/httpx/connection/http2.rb +16 -27
  58. data/lib/httpx/connection.rb +213 -120
  59. data/lib/httpx/domain_name.rb +10 -13
  60. data/lib/httpx/errors.rb +34 -2
  61. data/lib/httpx/extensions.rb +4 -134
  62. data/lib/httpx/io/ssl.rb +77 -71
  63. data/lib/httpx/io/tcp.rb +46 -70
  64. data/lib/httpx/io/udp.rb +18 -52
  65. data/lib/httpx/io/unix.rb +6 -13
  66. data/lib/httpx/io.rb +3 -9
  67. data/lib/httpx/loggable.rb +4 -19
  68. data/lib/httpx/options.rb +168 -110
  69. data/lib/httpx/plugins/{authentication → auth}/basic.rb +1 -5
  70. data/lib/httpx/plugins/{authentication → auth}/digest.rb +13 -14
  71. data/lib/httpx/plugins/{authentication → auth}/ntlm.rb +1 -3
  72. data/lib/httpx/plugins/{authentication → auth}/socks5.rb +0 -2
  73. data/lib/httpx/plugins/auth.rb +25 -0
  74. data/lib/httpx/plugins/aws_sdk_authentication.rb +1 -3
  75. data/lib/httpx/plugins/aws_sigv4.rb +5 -6
  76. data/lib/httpx/plugins/basic_auth.rb +29 -0
  77. data/lib/httpx/plugins/brotli.rb +50 -0
  78. data/lib/httpx/plugins/callbacks.rb +91 -0
  79. data/lib/httpx/plugins/circuit_breaker/circuit.rb +40 -16
  80. data/lib/httpx/plugins/circuit_breaker/circuit_store.rb +14 -5
  81. data/lib/httpx/plugins/circuit_breaker.rb +30 -7
  82. data/lib/httpx/plugins/cookies/set_cookie_parser.rb +0 -2
  83. data/lib/httpx/plugins/cookies.rb +20 -10
  84. data/lib/httpx/plugins/{digest_authentication.rb → digest_auth.rb} +11 -12
  85. data/lib/httpx/plugins/expect.rb +15 -13
  86. data/lib/httpx/plugins/follow_redirects.rb +71 -29
  87. data/lib/httpx/plugins/grpc/call.rb +2 -3
  88. data/lib/httpx/plugins/grpc/grpc_encoding.rb +88 -0
  89. data/lib/httpx/plugins/grpc/message.rb +7 -37
  90. data/lib/httpx/plugins/grpc.rb +35 -29
  91. data/lib/httpx/plugins/h2c.rb +25 -18
  92. data/lib/httpx/plugins/internal_telemetry.rb +16 -0
  93. data/lib/httpx/plugins/{ntlm_authentication.rb → ntlm_auth.rb} +7 -5
  94. data/lib/httpx/plugins/oauth.rb +170 -0
  95. data/lib/httpx/plugins/persistent.rb +1 -1
  96. data/lib/httpx/plugins/proxy/http.rb +15 -10
  97. data/lib/httpx/plugins/proxy/socks4.rb +8 -6
  98. data/lib/httpx/plugins/proxy/socks5.rb +10 -8
  99. data/lib/httpx/plugins/proxy.rb +69 -67
  100. data/lib/httpx/plugins/push_promise.rb +1 -1
  101. data/lib/httpx/plugins/rate_limiter.rb +3 -1
  102. data/lib/httpx/plugins/response_cache/file_store.rb +40 -0
  103. data/lib/httpx/plugins/response_cache/store.rb +34 -17
  104. data/lib/httpx/plugins/response_cache.rb +6 -6
  105. data/lib/httpx/plugins/retries.rb +61 -12
  106. data/lib/httpx/plugins/ssrf_filter.rb +142 -0
  107. data/lib/httpx/plugins/stream.rb +27 -32
  108. data/lib/httpx/plugins/upgrade/h2.rb +4 -4
  109. data/lib/httpx/plugins/upgrade.rb +8 -10
  110. data/lib/httpx/plugins/webdav.rb +10 -8
  111. data/lib/httpx/pool.rb +85 -23
  112. data/lib/httpx/punycode.rb +9 -291
  113. data/lib/httpx/request/body.rb +158 -0
  114. data/lib/httpx/request.rb +86 -121
  115. data/lib/httpx/resolver/https.rb +54 -17
  116. data/lib/httpx/resolver/multi.rb +8 -12
  117. data/lib/httpx/resolver/native.rb +163 -70
  118. data/lib/httpx/resolver/resolver.rb +28 -13
  119. data/lib/httpx/resolver/system.rb +15 -10
  120. data/lib/httpx/resolver.rb +38 -16
  121. data/lib/httpx/response/body.rb +242 -0
  122. data/lib/httpx/response/buffer.rb +96 -0
  123. data/lib/httpx/response.rb +113 -211
  124. data/lib/httpx/selector.rb +2 -4
  125. data/lib/httpx/session.rb +91 -64
  126. data/lib/httpx/session_extensions.rb +4 -1
  127. data/lib/httpx/timers.rb +28 -8
  128. data/lib/httpx/transcoder/body.rb +0 -2
  129. data/lib/httpx/transcoder/chunker.rb +0 -1
  130. data/lib/httpx/transcoder/deflate.rb +37 -0
  131. data/lib/httpx/transcoder/form.rb +52 -33
  132. data/lib/httpx/transcoder/gzip.rb +74 -0
  133. data/lib/httpx/transcoder/json.rb +2 -5
  134. data/lib/httpx/transcoder/multipart/decoder.rb +139 -0
  135. data/lib/httpx/{plugins → transcoder}/multipart/encoder.rb +3 -3
  136. data/lib/httpx/{plugins → transcoder}/multipart/mime_type_detector.rb +1 -1
  137. data/lib/httpx/{plugins → transcoder}/multipart/part.rb +3 -2
  138. data/lib/httpx/transcoder/multipart.rb +17 -0
  139. data/lib/httpx/transcoder/utils/body_reader.rb +46 -0
  140. data/lib/httpx/transcoder/utils/deflater.rb +72 -0
  141. data/lib/httpx/transcoder/utils/inflater.rb +19 -0
  142. data/lib/httpx/transcoder/xml.rb +0 -5
  143. data/lib/httpx/transcoder.rb +4 -6
  144. data/lib/httpx/utils.rb +36 -16
  145. data/lib/httpx/version.rb +1 -1
  146. data/lib/httpx.rb +12 -14
  147. data/sig/altsvc.rbs +33 -0
  148. data/sig/buffer.rbs +1 -0
  149. data/sig/callbacks.rbs +3 -3
  150. data/sig/chainable.rbs +10 -9
  151. data/sig/connection/http1.rbs +5 -4
  152. data/sig/connection/http2.rbs +1 -1
  153. data/sig/connection.rbs +46 -24
  154. data/sig/errors.rbs +9 -3
  155. data/sig/httpx.rbs +5 -4
  156. data/sig/io/ssl.rbs +26 -0
  157. data/sig/io/tcp.rbs +60 -0
  158. data/sig/io/udp.rbs +20 -0
  159. data/sig/io/unix.rbs +10 -0
  160. data/sig/options.rbs +28 -12
  161. data/sig/plugins/{authentication → auth}/basic.rbs +0 -2
  162. data/sig/plugins/{authentication → auth}/digest.rbs +2 -1
  163. data/sig/plugins/auth.rbs +13 -0
  164. data/sig/plugins/{basic_authentication.rbs → basic_auth.rbs} +2 -2
  165. data/sig/plugins/brotli.rbs +22 -0
  166. data/sig/plugins/callbacks.rbs +38 -0
  167. data/sig/plugins/circuit_breaker.rbs +13 -3
  168. data/sig/plugins/compression.rbs +6 -4
  169. data/sig/plugins/cookies/jar.rbs +2 -2
  170. data/sig/plugins/cookies.rbs +2 -0
  171. data/sig/plugins/{digest_authentication.rbs → digest_auth.rbs} +2 -2
  172. data/sig/plugins/follow_redirects.rbs +11 -2
  173. data/sig/plugins/grpc/call.rbs +19 -0
  174. data/sig/plugins/grpc/grpc_encoding.rbs +37 -0
  175. data/sig/plugins/grpc/message.rbs +17 -0
  176. data/sig/plugins/grpc.rbs +2 -32
  177. data/sig/plugins/h2c.rbs +1 -1
  178. data/sig/plugins/{ntlm_authentication.rbs → ntlm_auth.rbs} +2 -2
  179. data/sig/plugins/oauth.rbs +54 -0
  180. data/sig/plugins/proxy/socks4.rbs +4 -4
  181. data/sig/plugins/proxy/socks5.rbs +2 -2
  182. data/sig/plugins/proxy/ssh.rbs +1 -1
  183. data/sig/plugins/proxy.rbs +10 -4
  184. data/sig/plugins/response_cache.rbs +12 -3
  185. data/sig/plugins/retries.rbs +28 -8
  186. data/sig/plugins/stream.rbs +24 -17
  187. data/sig/plugins/upgrade.rbs +5 -3
  188. data/sig/pool.rbs +5 -4
  189. data/sig/request/body.rbs +40 -0
  190. data/sig/request.rbs +12 -28
  191. data/sig/resolver/https.rbs +7 -2
  192. data/sig/resolver/native.rbs +10 -4
  193. data/sig/resolver/resolver.rbs +6 -4
  194. data/sig/resolver/system.rbs +2 -0
  195. data/sig/resolver.rbs +9 -5
  196. data/sig/response/body.rbs +53 -0
  197. data/sig/response/buffer.rbs +24 -0
  198. data/sig/response.rbs +17 -38
  199. data/sig/session.rbs +24 -18
  200. data/sig/timers.rbs +17 -7
  201. data/sig/transcoder/body.rbs +4 -3
  202. data/sig/transcoder/deflate.rbs +11 -0
  203. data/sig/transcoder/form.rbs +5 -3
  204. data/sig/transcoder/gzip.rbs +24 -0
  205. data/sig/transcoder/json.rbs +4 -2
  206. data/sig/{plugins → transcoder}/multipart.rbs +3 -12
  207. data/sig/transcoder/utils/body_reader.rbs +15 -0
  208. data/sig/transcoder/utils/deflater.rbs +29 -0
  209. data/sig/transcoder/utils/inflater.rbs +12 -0
  210. data/sig/transcoder/xml.rbs +1 -1
  211. data/sig/transcoder.rbs +22 -7
  212. data/sig/utils.rbs +2 -0
  213. metadata +127 -40
  214. data/lib/httpx/plugins/authentication.rb +0 -20
  215. data/lib/httpx/plugins/basic_authentication.rb +0 -30
  216. data/lib/httpx/plugins/compression/brotli.rb +0 -54
  217. data/lib/httpx/plugins/compression/deflate.rb +0 -49
  218. data/lib/httpx/plugins/compression/gzip.rb +0 -88
  219. data/lib/httpx/plugins/compression.rb +0 -164
  220. data/lib/httpx/plugins/multipart/decoder.rb +0 -187
  221. data/lib/httpx/plugins/multipart.rb +0 -84
  222. data/lib/httpx/registry.rb +0 -85
  223. data/sig/plugins/authentication.rbs +0 -11
  224. data/sig/plugins/compression/brotli.rbs +0 -21
  225. data/sig/plugins/compression/deflate.rbs +0 -17
  226. data/sig/plugins/compression/gzip.rbs +0 -29
  227. data/sig/registry.rbs +0 -13
  228. /data/sig/plugins/{authentication → auth}/ntlm.rbs +0 -0
  229. /data/sig/plugins/{authentication → auth}/socks5.rbs +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c62cb1d027ee7e62770de459b00411614372578117ea56354df0d9114cf4397b
4
- data.tar.gz: 18275725fc8adeac596f02f83f034dfcfe24a7e4c96ec34bc11400e8ca0e9567
3
+ metadata.gz: 7e5ee54988be76a44ae512da359d83c502f8a43073f244a116a8fdc45fa7b87d
4
+ data.tar.gz: e3c08652a8d08eadbd1ef14b20005f93ff4131a712f8234c3eab94c7fce07167
5
5
  SHA512:
6
- metadata.gz: 840bf59a4cbbb45d26a836ccd4060007470d380314b4aedea58e49cb434b050a8252f7db3823daf9c2dfdb5d54075215e4ee1216c80852afbb7abfd57e1dfea2
7
- data.tar.gz: 35a666b92236240e8ccd09b1dc29a2ccf83061222b0511d35eee6fb7f3794dc737ca86ac9ca7d87ba01e03d8e648b07e6e52290b02b25674bd783b7f9d2cfbce
6
+ metadata.gz: 58f16e523d23215d89a8c873a5ce12491b52726073c334c4d9800e17e40dca8111ad43ab2467c37939a19bebbaa000c8db144fdbba87cc3d22cb699687df6699
7
+ data.tar.gz: 64dd9bb70af4173339019b62fa9f54fdf3f22c4bf593b51fb3de624844ac8a599a51b49cae10623aee8b8cff24af4dee69e39bedfec7da3d1ae229d733632e9c
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
 
@@ -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
 
@@ -4,7 +4,7 @@
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
 
@@ -4,12 +4,12 @@
4
4
 
5
5
  ### `:write_timeout`, `:read_timeout` and `:request_timeout`
6
6
 
7
- https://gitlab.com/honeyryderchuck/httpx/-/wikis/Timeouts
7
+ https://gitlab.com/os85/httpx/-/wikis/Timeouts
8
8
 
9
9
  The following timeouts are now supported:
10
10
 
11
11
  * `:write_timeout`: total time (in seconds) to write a request to the server;
12
- * `:read_timeout`: total time (in seconds) to read aa response from the server;
12
+ * `:read_timeout`: total time (in seconds) to read a response from the server;
13
13
  * `:request_timeout`: tracks both of the above (time to write the request and read a response);
14
14
 
15
15
  ```ruby
@@ -22,10 +22,12 @@ None of them has a default value, in order not to break integrations, but that'l
22
22
 
23
23
  ### Circuit Breaker plugin
24
24
 
25
- https://gitlab.com/honeyryderchuck/httpx/-/wikis/Circuit-Breaker
25
+ https://gitlab.com/os85/httpx/-/wikis/Circuit-Breaker
26
26
 
27
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
28
 
29
+ Read the wiki for more info about the defaults.
30
+
29
31
  ```ruby
30
32
  http = HTTPX.plugin(:circuit_breaker)
31
33
  # that's it!
@@ -34,7 +36,7 @@ http.get(...
34
36
 
35
37
  ### WebDAV plugin
36
38
 
37
- https://gitlab.com/honeyryderchuck/httpx/-/wikis/WebDav
39
+ https://gitlab.com/os85/httpx/-/wikis/WebDav
38
40
 
39
41
  The `:webdav` introduces some "convenience" methods to perform common WebDAV operations.
40
42
 
@@ -49,7 +51,7 @@ res = webdav.copy("/file.html", "/newdir/copy.html")
49
51
 
50
52
  ### XML transcoder, `:xml` option and `response.xml`
51
53
 
52
- 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:
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:
53
55
 
54
56
  ```ruby
55
57
  response = HTTPX.post("https://xml-server.com", xml: Nokogiri::XML("<xml ..."))
@@ -0,0 +1,12 @@
1
+ # 0.21.1
2
+
3
+ ## Bugfixes
4
+
5
+ * fix: protecting tcp connect phase against low-level syscall errors
6
+ * such as network unreachable, which can happen if connectivity is lost meanwhile.
7
+ * native resolver: fix for nameserver switch not happening in case of DNS timeout.
8
+ * when more than a nameserver was advertised by the system.
9
+
10
+ ## Chore
11
+
12
+ * Removing usage of deprecated `Random::DEFAULT.rand` (using `Random.rand` instead)-
@@ -0,0 +1,13 @@
1
+ # 0.22.0
2
+
3
+ ## Improvements
4
+
5
+ ### Happy Eyeballs v2 finalized
6
+
7
+ Until now, httpx was issuing concurrent DNS requests, but it'd only start connecting to the first, and then on the following by the right order, but sequentially.
8
+
9
+ `httpx` will now establish connections concurrently to both IPv6 and IPv4 addresses of a given domain; the first one to succeed terminates the other. Successful connection means completion of both TCP and TLS (when applicable) handshakes.
10
+
11
+ ### HTTPX::Response::Body#encoding
12
+
13
+ A new method, `#encoding`, can be called on response bodies. It'll return the encoding of the response payload.
@@ -0,0 +1,11 @@
1
+ # 0.22.1
2
+
3
+ ## Bugfixes
4
+
5
+ * `:retries` plugin: fix `HTTPX::Response#response to point to last possible response in the redirection chain.
6
+ * `:stream` plugin: Make `HTTPX::Session#request` public (as it is inn the main class) .
7
+ * return 100 responses if the request didn't specifically ask for "100-continue" negotiation (via the "expect" header).
8
+
9
+ ## Improvements
10
+
11
+ Wrap low-level socket errors in a `HTTPX::ConnectionError` exception.
@@ -0,0 +1,5 @@
1
+ # 0.22.2
2
+
3
+ ## Chore
4
+
5
+ Checking response class before calling `.status`, as this was being called in some places on error responses, thereby triggering the deprecation warning.
@@ -0,0 +1,55 @@
1
+ # 0.22.3
2
+
3
+ ## Features
4
+
5
+ ### HTTPX::Response::Body#filename
6
+
7
+ A new method, `.filename` can be called on response bodies, to get the filename referenced by the server for the received payload (usually in the "Content-Disposition" header).
8
+
9
+ ```ruby
10
+ response = HTTPX.get(url)
11
+ response.raise_for_status
12
+ filename = response.body.filename
13
+ # you can do, for example:
14
+ response.body.copy_to("/home/files/#{filename}")
15
+ ```
16
+
17
+ ## Improvements
18
+
19
+ ### Loading integrations by default
20
+
21
+ Integrations will be loaded by default, as long as the dependency being integrated is already available:
22
+
23
+ ```ruby
24
+ require "ddtrace"
25
+ require "httpx"
26
+
27
+ HTTPX.get(... # request will be traced via the datadog integration
28
+ ```
29
+
30
+ ### Faraday: better error handling
31
+
32
+ The `faraday` adapter will not raise errors anymore, when used in parallel mode. This fixes the difference in behaviour with the equivalent `typhoeus` parallel adapter, which does not raise errors in such cases as well. This behaviour will exclude 4xx and 5xx HTTP responses, which will not be considered errors in the `faraday` adapter.
33
+
34
+ If errors occur in parallel mode, these'll be available in `env[:error]`. Users can check it in two ways:
35
+
36
+ ```ruby
37
+ response.status == 0
38
+ # or
39
+ !response.env[:error].nil?
40
+ ```
41
+
42
+ ## Bugfixes
43
+
44
+ * unix socket: handle the error when the path for the unix sock is invalid, which was causing an endless loop.
45
+
46
+ ### IPv6 / Happy eyeballs v2
47
+
48
+ * the `native` resolver will now use IPv6 nameservers with zone identifier to perform DNS queries. This bug was being ignored prior to ruby 3.1 due to some pre-filtering on the nameservere which were covering misuse of the `uri` dependency for this use case.
49
+ * Happy Eyeballs v2 handshake error on connection establishment for the first IP will now ignore it, in case an ongoing connecting for the second IP is happening. This fixes a case where both IPv4 and IPv6 addresses are served for a given domain, but only one of them can be connected to (i.e. if connection via IPv6 fails, the IPv4 one should still proceed to completion).
50
+ * the `native` resolver won't try querying DNS name candidates, if the resolver sends an empty answer with an error code different from "domain not found".
51
+ * fix error of Happy Eyeballs v2 handshake, where the resulting connection would coalesce with an already open one for the same IP **before** requests were merged to the coalesced connection, resulting in no requests being sent and the client hanging.
52
+
53
+ ## Chore
54
+
55
+ * fixed error message on wrong type of parameter for the `compression_threshold_size` option from the `:compression` plugin.
@@ -0,0 +1,6 @@
1
+ # 0.22.4
2
+
3
+ ## Bugfixes
4
+
5
+ * fix happy eyeballs v2 bug where, once the first connection would be established, the remaining one would still end up in the coalescing loop, thereby closing itself via the `:tcp_open` callback.
6
+ * fix for faraday plugin parallel mode, where it'd hang if no requests would be made in the parallel block (@catlee)
@@ -0,0 +1,6 @@
1
+ # 0.22.5
2
+
3
+ ## Bugfixes
4
+
5
+ * `datadog` and `sentry` integrations did not account for `Connection#send` being possibly called multiple times (something possible for connection coalescing, max requests exhaustion, or Happy Eyeballs 2), and were registering multiple `on(:response)` callbacks. Requests are now marked when decorated the first time.
6
+ * Happy Eyeballs handshake "connect errors" routine is now taking both name resolution errors, as well as TLS handshake errors, into account, when the handshake fails.