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
@@ -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.