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
@@ -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.
@@ -0,0 +1,42 @@
1
+ # 0.23.0
2
+
3
+ ## Features
4
+
5
+ ### `:retries` plugin: resumable requests
6
+
7
+ The `:retries` plugin will now support scenarios where, if the request being retried supports the `range` header, and a partial response has been already buffered, the retry will resume from there and only download the missing data.
8
+
9
+ #### HTTPX::ErrorResponse#response
10
+
11
+ As a result, ´HTTPX::ErrorResponse#response` has also been introduced; error responses may have an actual response. This happens in cases where the request failed **after** a partial response was initiated.
12
+
13
+ #### `:buffer_size` option
14
+
15
+ A nnew option, `:buffer_size`, can be used to tweak the buffers used by the read/write socket routines (16k by default, you can lower it in memory-constrained environments).
16
+
17
+ ## Improvements
18
+
19
+ ### `:native` resolver falls back to TCP for truncated messages
20
+
21
+ The `:native` resolver will repeat DNS queries to a nameserver via TCP when the first attempt is marked as truncated. This behaviour is both aligned with `getaddrinfo` and the `resolv` standard library.
22
+
23
+ This introduces a new `resolver_options` option, `:socket_type`, which can now be `:tcp` if it is to remain the default.
24
+
25
+ ## Chore
26
+
27
+ ### HTTPX.build_request should receive upcased string (i.e. "GET")
28
+
29
+ Functions which receive an HTTP verb should be given he verb in "upcased string" format now. The usage of symbols is still possible, but a deprecation warning will be emitted, and support will be removed in v1.0.0 .
30
+
31
+ ### Remove HTTPX::Registry
32
+
33
+ These internal registries were a bit magical to use, difficult to debug, not thread-safe, and overall a nuisance when it came to type checking. While there is the possibility that someone was relying on it existing, nothing had ever been publicly documented.
34
+
35
+ ## Bugfixes
36
+
37
+ * fixed proxy discovery using proxy env vars (`HTTPS_PROXY`, `NO_PROXY`...) being enabled/disabled based on first host uused in the session;
38
+ * fixed `:no_proxy` option usage inn the `:proxy` plugin.
39
+ * fixed `webmock` adapter to correctly disable it when `Webmock.disable!` is called.
40
+ * fixed bug in `:digest_authentication` plugin when enabled and no credentials were passed.
41
+ * fixed several bugs in the `sentry` adapter around breadcrumb handling.
42
+ * fixed `:native` resolver candidate calculation by putting absolute domain at the bottom of the list.
@@ -0,0 +1,5 @@
1
+ # 0.23.1
2
+
3
+ ## Bugfixes
4
+
5
+ * fixed regression causing dns candidate names not being tried after first one fails.
@@ -0,0 +1,5 @@
1
+ # 0.23.2
2
+
3
+ ## Bugfixes
4
+
5
+ * fix missing variable on code path in the native resolver.
@@ -0,0 +1,6 @@
1
+ # 0.23.3
2
+
3
+ ## Bugfixes
4
+
5
+ * native resolver: fix missing exception variable in the DNS error code path.
6
+ * native resolver: fixed short DNS packet handling when using TCP.
@@ -0,0 +1,5 @@
1
+ # 0.23.4
2
+
3
+ ## Bugfixes
4
+
5
+ * fix `Response::Body#read` which rewinds on every call.
@@ -0,0 +1,48 @@
1
+ # 0.24.0
2
+
3
+ ## Features
4
+
5
+ ### `:oauth` plugin
6
+
7
+ The `:oauth` plugin manages the handling of a given OAuth session, in that it ships with convenience methods to generate a new access token, which it then injects in all requests.
8
+
9
+ More info under https://honeyryderchuck.gitlab.io/httpx/wiki/OAuth
10
+
11
+ ### session callbacks
12
+
13
+ HTTP request/response lifecycle events have now the ability of being intercepted via public API callback methods:
14
+
15
+ ```ruby
16
+ HTTPX.on_request_completed do |request|
17
+ puts "request to #{request.uri} sent"
18
+ end.get(...)
19
+ ```
20
+
21
+ More info under https://honeyryderchuck.gitlab.io/httpx/wiki/Events to know which events and callback methods are supported.
22
+
23
+ ### `:circuit_breaker` plugin `on_circuit_open` callback
24
+
25
+ A callback has been introduced for the `:circuit_breaker` plugin, which is triggered when a circuit is opened.
26
+
27
+ ```ruby
28
+ http = HTTPX.plugin(:circuit_breaker).on_circuit_open do |req|
29
+ puts "circuit opened for #{req.uri}"
30
+ end
31
+ http.get(...)
32
+ ```
33
+
34
+ ## Improvements
35
+
36
+ Several `:response_cache` features have been improved:
37
+
38
+ * `:response_cache` plugin: response cache store has been made thread-safe.
39
+ * cached response sharing across threads is made safer, as stringio/tempfile instances are copied instead of shared (without copying the underling string/file).
40
+ * stale cached responses are eliminate on cache store lookup/store operations.
41
+ * already closed responses are evicted from the cache store.
42
+ * fallback for lack of compatible response "date" header has been fixed to return a `Time` object.
43
+
44
+ ## Bugfixes
45
+
46
+ * Ability to recover from errors happening during response chunk processing (required for overriding behaviour and response chunk callbacks); error bubbling up will result in the connection being closed.
47
+ * Happy eyeballs support for multi-homed early-resolved domain names (such as `localhost` under `/etc/hosts`) was broken, as it would try the first given IP; so, if given `::1` and connection would fail, it wouldn't try `127.0.0.1`, which would have succeeded.
48
+ * `:digest_authentication` plugin was removing the "algorithm" header on `-sess` declared algorithms, which is required for HTTP digest auth negotiation.
@@ -0,0 +1,12 @@
1
+ # 0.24.1
2
+
3
+ ## Improvements
4
+
5
+ * datadog adapter: support `:service_name` configuration option.
6
+ * datadog adapter: set `:distributed_tracing` to `true` by default.
7
+ * `:proxy` plugin: when the proxy uri uses an unsupported scheme (i.e.: "scp://125.24.2.1"), a more user friendly error is raised (instead of the previous broken stacktrace).
8
+
9
+ ## Bugfixes
10
+
11
+ * datadog adapter: fix tracing enable call, which was wrongly calling `super`.
12
+ + `:proxy` plugin: fix for bug which was turning off plugins overriding `HTTPX::Connection#send` (such as the datadog adapter).
@@ -0,0 +1,12 @@
1
+ # 0.24.2
2
+
3
+ ## Improvements
4
+
5
+ * besides an array, `:resolver_options` can now receive a hash for `:nameserver`, which **must** be indexed by IP family (`Socket::AF_INET6` or `Socket::AF_INET`); each group of nameservers will be used for emitting DNS queries of that iP family.
6
+ * `:authentication` plugin: Added `#bearer_auth` helper, which receives a token, and sets it as `"Bearer $TOKEN` in the `"authorization"` header.
7
+ * `faraday` adapter: now implements `#build_connection` and `#close`, will now interact with `faraday` native timeouts (`:read`, `:write` and `:connect`).
8
+
9
+
10
+ ## Bugfixes
11
+
12
+ * fixed native resolver bug when queries involving intermediate alias would be kept after the original query and mess with re-queries.
@@ -0,0 +1,12 @@
1
+ # 0.24.3
2
+
3
+ ## Improvements
4
+
5
+ * faraday adapter: reraise httpx timeout errors as faraday errors.
6
+ * faraday adapter: support `:bind` option, which expects a host and port to connect to.
7
+
8
+ ## Bugfixes
9
+
10
+ * faraday adapter: fix `#close` implementation using the wrong ivar.
11
+ * faraday adapter: fix usage of `requestt_timeout` translation of faraday timeouts into httpx timeouts.
12
+ * faraday adapter: `ssl: { verify: false }` was being ignored, and certification verification was still proceeding.
@@ -0,0 +1,18 @@
1
+ # 0.24.4
2
+
3
+ ## Improvements
4
+
5
+ * `digest_authentication` plugin now supports passing HA1hashed with password HA1s (common to store in htdigest files for example) when setting the`:hashed` kwarg to `true` in the `.digest_auth` call.
6
+ * ex: `http.digest_auth(user, get_hashed_passwd_from_htdigest(user), hashed: true)`
7
+ * TLS session resumption is now supported
8
+ * whenever possible, `httpx` sessions will recycle used connections so that, in the case of TLS connections, the first session will keep being reusedd, thereby diminishing the overhead of subsequent TLS handshakes on the same host.
9
+ * TLS sessions are only reused in the scope of the same `httpx` session, unless the `:persistent` plugin is used, in which case, the persisted `httpx` session will always try to resume TLS sessions.
10
+
11
+ ## Bugfixes
12
+
13
+ * When explicitly using IP addresses in the URL host, TLS handshake will now verify tif he IP address is included in the certificate.
14
+ * IP address will keep not be used for SNI, as per RFC 6066, section 3.
15
+ * ex: `http.get("https://10.12.0.12/get")`
16
+ * if you want the prior behavior, set `HTTPX.with(ssl: {verify_hostname: false})`
17
+ * Turn TLS hostname verification on for `jruby` (it's turned off by default).
18
+ * if you want the prior behavior, set `HTTPX.with(ssl: {verify_hostname: false})`
@@ -0,0 +1,6 @@
1
+ # 0.24.5
2
+
3
+ ## Bugfixes
4
+
5
+ * fix for SSL handshake post connection SAN check using IPv6 address.
6
+ * fix bug in DoH impl when the request returned no answer.
@@ -0,0 +1,5 @@
1
+ # 0.24.6
2
+
3
+ ## Bugfixes
4
+
5
+ * fix Session class assertions not prepared for class overrides, which could break some plugins which override the Session class on load (such as `datadog` or `webmock` adapters).
@@ -0,0 +1,10 @@
1
+ # 0.24.6
2
+
3
+ ## dependencies
4
+
5
+ `http-2-next` last supported version for the 0.x series is the last version before v1. This shoul ensure that older versions of `httpx` won't be affected by any of the recent breaking changes.
6
+
7
+ ## Bugfixes
8
+
9
+ * `grpc`: setup of rpc calls from camel-cased symbols has been fixed. As an improvement, the GRPC-enabled session will now support both snake-cased, as well as camel-cased calls.
10
+ * `datadog` adapter has now been patched to support the most recent breaking changes of `ddtrace` configuration DSL (`env_to_bool` is no longer supported).
@@ -0,0 +1,60 @@
1
+ # 1.0.0
2
+
3
+ ## Breaking changes
4
+
5
+ * the minimum supported ruby version is 2.7.0 .
6
+ * The fallback support for IDNA 2003 has been removed. If you require this feature, install the [idnx gem](https://github.com/HoneyryderChuck/idnx), which `httpx` automatically integrates with when available (and supports IDNA 2008).
7
+ * `:total_timeout` option has been removed (no session-wide timeout supported, use `:request_timeout`).
8
+ * `:read_timeout` and `:write_timeout` are now set to 60 seconds by default, and preferred over `:operation_timeout`;
9
+ * the exception being in the `:stream` plugin, as the response is theoretically endless (so `:read_timeout` is unset).
10
+ * The `:multipart` plugin is removed, as its functionality and API are now loaded by default (no API changes).
11
+ * The `:compression` plugin is removed, as its functionality and API are now loaded by default (no API changes).
12
+ * `:compression_threshold_size` was removed (formats in `"content-encoding"` request header will always encode the request body).
13
+ * the new `:compress_request_body` and `:decompress_response_body` can be set to `false` to (respectively) disable compression of passed input body, or decompression of the response body.
14
+ * `:retries` plugin: the `:retry_on` condition will **not** replace default retriable error checks, it will now instead be triggered **only if** no retryable error has been found.
15
+
16
+ ### plugins
17
+
18
+ * `:authentication` plugin becomes `:auth`.
19
+ * `.authentication` helper becomes `.authorization`.
20
+ * `:basic_authentication` plugin becomes `:basic_auth`.
21
+ * `:basic_authentication` helper is removed.
22
+ * `:digest_authentication` plugin becomes `:digest_auth`.
23
+ * `:digest_authentication` helper is removed.
24
+ * `:ntlm_authentication` plugin becomes `:ntlm_auth`.
25
+ * `:ntlm_authentication` helper is removed.
26
+ * OAuth plugin: `:oauth_authentication` helper is rename to `:oauth_auth`.
27
+ * `:compression/brotli` plugin becomes `:brotli`.
28
+
29
+ ### Support removed for deprecated APIs
30
+
31
+ * The deprecated `HTTPX::Client` constant lookup has been removed (use `HTTPX::Session` instead).
32
+ * The deprecated `HTTPX.timeout({...})` function has been removed (use `HTTPX.with(timeout: {...})` instead).
33
+ * The deprecated `HTTPX.headers({...})` function has been removed (use `HTTPX.with(headers: {...})` instead).
34
+ * The deprecated `HTTPX.plugins(...)` function has been removed (use `HTTPX.plugin(...).plugin(...)...` instead).
35
+ * The deprecated `:transport_options` option, which was only valid for UNIX connections, has been removed (use `:addresses` instead).
36
+ * The deprecated `def_option(...)` function, previously used to define additional options in plugins, has been removed (use `def option_$new_option)` instead).
37
+ * The deprecated `:loop_timeout` timeout option has been removed.
38
+ * `:stream` plugin: the deprecated `HTTPX::InstanceMethods::StreamResponse` has been removed (use `HTTPX::StreamResponse` instead).
39
+ * The deprecated usage of symbols to indicate HTTP verbs (i.e. `HTTPX.request(:get, ...)` or `HTTPX.build_request(:get, ...)`) is not supported anymore (use the upcase string always, i.e. `HTTPX.request("GET", ...)` or `HTTPX.build_request("GET", ...)`, instead).
40
+ * The deprecated `HTTPX::ErrorResponse#status` method has been removed (use `HTTPX::ErrorResponse#error` instead).
41
+
42
+ ### dependencies
43
+
44
+ * `http-2-next` minimum supported version is 1.0.0.
45
+ * `:datadog` adapter only supports `ddtrace` gem 1.x or higher.
46
+ * `:faraday` adapter only supports `faraday` gem 1.x or higher.
47
+
48
+ ## Improvements
49
+
50
+ * `circuit_breaker`: the drip rate of real request during the "half-open" stage of a circuit will reliably distribute real requests (as per the drip rate) over the `max_attempts`, before the circuit is closed.
51
+
52
+ ## Bugfixes
53
+
54
+ * Tempfiles are now correctly identified as file inputs for multipart requests.
55
+ * fixed `proxy` plugin behaviour when loaded with the `follow_redirects` plugin and processing a 305 response (request needs to be retried on a different proxy).
56
+
57
+ ## Chore
58
+
59
+ * `:grpc` plugin: connection won't buffer requests before HTTP/2 handshake is commpleted, i.e. works the same as plain `httpx` HTTP/2 connection establishment.
60
+ * if you are relying on this, you can keep the old behavior this way: `HTTPX.plugin(:grpc, http2_settings: { wait_for_handshake: false })`.
@@ -0,0 +1,5 @@
1
+ # 1.0.1
2
+
3
+ ## Bugfixes
4
+
5
+ * do not try to inflate empty chunks (it triggered an error during response decoding).
@@ -0,0 +1,7 @@
1
+ # 1.0.2
2
+
3
+ ## bugfixes
4
+
5
+ * bump `http-2-next` to 1.0.1, which fixes a bug where http/2 connection interprets MAX_CONCURRENT_STREAMS as request cap.
6
+ * `grpc`: setup of rpc calls from camel-cased symbols has been fixed. As an improvement, the GRPC-enabled session will now support both snake-cased, as well as camel-cased calls.
7
+ * `datadog` adapter has now been patched to support the most recent breaking changes of `ddtrace` configuration DSL (`env_to_bool` is no longer supported).
@@ -0,0 +1,32 @@
1
+ # 1.1.0
2
+
3
+ ## Features
4
+
5
+ A function, `#peer_address`, was added to the response object, which returns the IP (either a string or an `IPAddr` object) from the socket used to get the response from.
6
+
7
+ ```ruby
8
+ response = HTTPX.get("https://example.com")
9
+ response.peer_address #=> #<IPAddr: IPv4:93.184.216.34/255.255.255.255>
10
+ ```
11
+
12
+ error responses will also expose an IP address via `#peer_address` as long a connection happened before the error.
13
+
14
+ ## Improvements
15
+
16
+ * A performance regression involving the new default timeouts has been fixed, which could cause significant overhead in "multiple requests in sequence" scenarios, and was clearly visible in benchmarks.
17
+ * this regression will still be seen in jruby due to a bug, which fix will be released in jruby 9.4.5.0.
18
+ * HTTP/1.1 connections are now set to handle as many requests as they can by default (instead of the past default of max 200, at which point they'd be recycled).
19
+ * tolerate the inexistence of `openssl` in the installed ruby, like `net-http` does.
20
+ * `on_connection_opened` and `on_connection_closed` will yield the `OpenSSL::SSL::SSLSocket` instance for `https` backed origins (instead of always the `Socket` instance).
21
+
22
+ ## Bugfixes
23
+
24
+ * when using the `:native` resolver (default option), a default of 1 for ndots is set, for systems which do not set one.
25
+ * replaced usage of `Float::INFINITY` with `nil` for timeout defaults, as the former can't be used in IO wait functions.
26
+ * `faraday` adapter timeout setup now maps to `:read_timeout` and `:write_timeout` options from `httpx`.
27
+ * fixed HTTP/1.1 connection recycling on number of max requests exhausted.
28
+ * `response.json` will now work when "content-type" header is set to "application/hal+json".
29
+
30
+ ## Chore
31
+
32
+ * when using the `:cookies` plugin, a warning message to install the idnx message will only be emitted if the cookie domain is an IDN (this message was being shown all the time since v1 release).
@@ -0,0 +1,17 @@
1
+ # 1.1.1
2
+
3
+ ## improvements
4
+
5
+ * (Re-)enabling default retries in DNS name queries; this had been disabled as a result of revamping timeouts, and resulted in queries only being sent once, which is very little for UDP-related traffic, and breaks if using DNs rate-limiting software. Retries the query just once, for now.
6
+
7
+ ## bugfixes
8
+
9
+ * reset timers when adding new intervals, as these may be added as a result on after-select connection handling, and must wait for the next tick cycle (before the patch, they were triggering too soon).
10
+ * fixed "on close" callback leak on connection reuse, which caused linear performance regression in benchmarks performing one request per connection.
11
+ * fixed hanging connection when an HTTP/1.1 emitted a "connection: close" header but the server would not emit one (it closes the connection now).
12
+ * fixed recursive dns cached lookups which may have already expired, and created nil entries in the returned address list.
13
+ * dns system resolver is now able to retry on failure.
14
+
15
+ ## chore
16
+
17
+ * remove duplicated callback unregitering connections.
@@ -0,0 +1,12 @@
1
+ # 1.1.2
2
+
3
+ ## improvements
4
+
5
+ * only moving eden connections to idle when they're recycled.
6
+
7
+ ## bugfixes
8
+
9
+ * skip closing a connection which is already closed during reset.
10
+ * sentry adapter: fixed `super` call which didn't have a super method (this prevented usinng sentry-enabled sessions with the `:retries` plugin).
11
+ * sentry adapter: fixing registering of sentry config.
12
+ * sentry adapter: do not propagate traces when relevant sdk options are disabled (such as `propagate_traces`).
@@ -0,0 +1,18 @@
1
+ # 1.1.3
2
+
3
+ ## improvements
4
+
5
+ ## security
6
+
7
+ * when using `:follow_redirects` plugin, the "authorization" header will be removed when following redirect responses to a different origin.
8
+
9
+ ## bugfixes
10
+
11
+ * fixed `:stream` plugin not following redirect responses when used with the `:follow_redirects` plugin.
12
+ * fixed `:stream` plugin not doing content decoding when responses were p.ex. gzip-compressed.
13
+ * fixed bug preventing usage of IPv6 loopback or link-local addresses in the request URL in systems with no IPv6 internet connectivity (the request was left hanging).
14
+ * protect all code which may initiate a new connection from abrupt errors (such as internet turned off), as it was done on the initial request call.
15
+
16
+ ## chore
17
+
18
+ internal usage of `mutex_m` has been removed (`mutex_m` is going to be deprecated in ruby 3.3).
@@ -0,0 +1,6 @@
1
+ # 1.1.4
2
+
3
+ ## bugfixes
4
+
5
+ * datadog adapter: use `Gem::Version` to invoke the correct configuration API.
6
+ * stream plugin: do not preempt request enqueuing (this was making integration with the `:follow_redirects` plugin fail when set up with `webmock`).
@@ -0,0 +1,12 @@
1
+ # 1.1.5
2
+
3
+ ## improvements
4
+
5
+ * pattern matching support for responses has been backported to ruby 2.7 as well.
6
+
7
+ ## bugfixes
8
+
9
+ * `stream` plugin: fix for `HTTPX::StreamResponse#each_line` not yielding the last line of the payload when not delimiter-terminated.
10
+ * `stream` plugin: fix `webmock` adapter integration when methods calls would happen in the `HTTPX::StreamResponse#each` block.
11
+ * `stream` plugin: fix `:follow_redirects` plugin integration which was caching the redirect response and using it for method calls inside the `HTTPX::StreamResponse#each` block.
12
+ * "103 early hints" responses will be ignored when processing the response (it was causing the response returned by sesssions to hold its headers, instead of the following 200 response, while keeping the 200 response body).
@@ -0,0 +1,49 @@
1
+ # 1.2.0
2
+
3
+ ## Features
4
+
5
+ ### `:ssrf_filter` plugin
6
+
7
+ The `:ssrf_filter` plugin prevents server-side request forgery attacks, by blocking requests to the internal network. This is useful when the URLs used to perform requests aren’t under the developer control (such as when they are inserted via a web application form).
8
+
9
+ ```ruby
10
+ http = HTTPX.plugin(:ssrf_filter)
11
+
12
+ # this works
13
+ response = http.get("https://example.com")
14
+
15
+ # this doesn't
16
+ response = http.get("http://localhost:3002")
17
+ response = http.get("http://[::1]:3002")
18
+ response = http.get("http://169.254.169.254/latest/meta-data/")
19
+ ```
20
+
21
+ More info under https://honeyryderchuck.gitlab.io/httpx/wiki/SSRF-Filter
22
+
23
+ ### `:callbacks` plugin
24
+
25
+ The session callbacks introduced in v0.24.0 are in its own plugin. Older code will still work and emit a deprecation warning.
26
+
27
+ More info under https://honeyryderchuck.gitlab.io/httpx/wiki/Callbacks
28
+
29
+ ### `:redirect_on` option for `:follow_redirects` plugin
30
+
31
+ This option allows passing a callback which, when returning `false`, can interrupt the redirect loop.
32
+
33
+ ```ruby
34
+ http = HTTPX.plugin(:follow_redirects).with(redirect_on: ->(location_uri) { BLACKLIST_HOSTS.include?(location_uri.host) })
35
+ ```
36
+
37
+ ### `:close_on_handshake_timeout` timeout
38
+
39
+ A new `:timeout` option, `:close_handshake_timeout`, is added, which monitors connection readiness when performing HTTP/2 connection termination handshake.
40
+
41
+ ## Improvements
42
+
43
+ * Internal "eden connections" concept was removed, and connection objects are now kept-and-reused during the lifetime of a session, even when closed. This simplified connectio pool implementation and improved performance.
44
+ * request using `:proxy` and `:retries` plugin enabled sessions will now retry on proxy connection establishment related errors.
45
+
46
+ ## Bugfixes
47
+
48
+ * webmock adapter: mocked responses storing decoded payloads won't try to decode them again (fixes vcr/webmock integrations).
49
+ * webmock adapter: fix issue related with making real requests over webmock-enabled connection.
@@ -0,0 +1,6 @@
1
+ # 1.2.1
2
+
3
+ ## Bugfixes
4
+
5
+ * DoH resolver: try resolving other candidates on "domain not found" error (same behaviour as with native resolver).
6
+ * Allow HTTP/2 connections to exit cleanly when TLS session gets corrupted and termination handshake can't be performed.
@@ -0,0 +1,10 @@
1
+ # 1.2.2
2
+
3
+ ## Bugfixes
4
+
5
+ * only raise "unknown option" error when option is not supported, not anymore when error happens in the setup of a support option.
6
+ * usage of `HTTPX::Session#wrap` within a thread with other sessions using the `:persistent` plugin won't inadvertedly terminate its open connections.
7
+ * terminate connections on `IOError` (`SocketError` does not cover them).
8
+ * terminate connections on HTTP/2 protocol and handshake errors, which happen during establishment or termination of a HTTP/2 connection (they were being previously kept around, although they'd irrecoverable).
9
+ * `:oauth` plugin: fixing check preventing the OAuth metadata server integration path to be exercised.
10
+ * fix instantiation of the options headers object with the wrong headers class.
@@ -0,0 +1,16 @@
1
+ # 1.2.3
2
+
3
+ ## Improvements
4
+
5
+ * `:retries` plugin: allow `:max_retries` set to 0 (allows for a soft disable of retries when using the faraday adapter).
6
+
7
+ ## Bugfixes
8
+
9
+ * `:oauth` plugin: fix for default auth method being ignored when setting grant type and scope as options only.
10
+ * ensure happy eyeballs-initiated cloned connections also set session callbacks (caused issues when server would respond with a 421 response, an event requiring a valid internal callback).
11
+ * native resolver cleanly transitions from tcp to udp after truncated DNS query (causing issues on follow-up CNAME resolution).
12
+ * elapsing timeouts now guard against mutation of callbacks while looping (prevents skipping callbacks in situations where a previous one would remove itself from the collection).
13
+
14
+ ## Chore
15
+
16
+ * datadog adapter: do not call `.lazy` on options (avoids deprecation warning, to be removed in ddtrace 2.0)
@@ -0,0 +1,8 @@
1
+ # 1.2.4
2
+
3
+ ## Bugfixes
4
+
5
+ * fixed issue related to inability to buffer payload to error responses (which may happen on certain error handling situations).
6
+ * fixed recovery from a lost persistent connection leaving process due to ping being sent while still marked as inactive.
7
+ * fixed datadog integration, which was not generating new spans on retried requests (when `:retries` plugin is enabled).
8
+ * fixed splitting strings into key value pairs in cases where the value would contain a "=", such as in certain base64 payloads.
@@ -0,0 +1,7 @@
1
+ # 1.2.5
2
+
3
+ ## Bugfixes
4
+
5
+ * fix for usage of correct `last-modified` header in `response_cache` plugin.
6
+ * fix usage of decoding helper methods (i.e. `response.json`) with `response_cache` plugin.
7
+ * `stream` plugin: reverted back to yielding buffered payloads for streamed responses (broke `down` integration)
@@ -0,0 +1,13 @@
1
+ # 1.2.6
2
+
3
+ ## Improvements
4
+
5
+ * `native` resolver: when timing out on DNS query for an alias, retry the DNS query for the alias (instead of the original hostname).
6
+
7
+ ## Bugfixes
8
+
9
+ * `faraday` adapter: set `env` options on the request object, so they are available in the request object when yielded.
10
+ * `follow_redirects` plugin: remove body-related headers (`content-length`, `content-type`) on POST-to-GET redirects.
11
+ * `follow_redirects` plugin: maintain verb (and body) of original request when the response status code is 307.
12
+ * `native` resolver: when timing out on TCP-based name resolution, downgrade to UDP before retrying.
13
+ * `rate_limiter` plugin: do not try fetching the retry-after of error responses.