httpx-patched 1.6.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE.txt +191 -0
- data/README.md +162 -0
- data/doc/release_notes/0_0_1.md +7 -0
- data/doc/release_notes/0_0_2.md +9 -0
- data/doc/release_notes/0_0_3.md +9 -0
- data/doc/release_notes/0_0_4.md +7 -0
- data/doc/release_notes/0_0_5.md +5 -0
- data/doc/release_notes/0_10_0.md +66 -0
- data/doc/release_notes/0_10_1.md +37 -0
- data/doc/release_notes/0_10_2.md +5 -0
- data/doc/release_notes/0_11_0.md +74 -0
- data/doc/release_notes/0_11_1.md +5 -0
- data/doc/release_notes/0_11_2.md +5 -0
- data/doc/release_notes/0_11_3.md +5 -0
- data/doc/release_notes/0_12_0.md +55 -0
- data/doc/release_notes/0_13_0.md +58 -0
- data/doc/release_notes/0_13_1.md +5 -0
- data/doc/release_notes/0_13_2.md +9 -0
- data/doc/release_notes/0_14_0.md +79 -0
- data/doc/release_notes/0_14_1.md +7 -0
- data/doc/release_notes/0_14_2.md +6 -0
- data/doc/release_notes/0_14_3.md +5 -0
- data/doc/release_notes/0_14_4.md +5 -0
- data/doc/release_notes/0_14_5.md +11 -0
- data/doc/release_notes/0_15_0.md +53 -0
- data/doc/release_notes/0_15_1.md +8 -0
- data/doc/release_notes/0_15_2.md +9 -0
- data/doc/release_notes/0_15_3.md +5 -0
- data/doc/release_notes/0_15_4.md +5 -0
- data/doc/release_notes/0_16_0.md +93 -0
- data/doc/release_notes/0_16_1.md +5 -0
- data/doc/release_notes/0_17_0.md +49 -0
- data/doc/release_notes/0_18_0.md +69 -0
- data/doc/release_notes/0_18_1.md +12 -0
- data/doc/release_notes/0_18_2.md +10 -0
- data/doc/release_notes/0_18_3.md +7 -0
- data/doc/release_notes/0_18_4.md +14 -0
- data/doc/release_notes/0_18_5.md +10 -0
- data/doc/release_notes/0_18_6.md +5 -0
- data/doc/release_notes/0_18_7.md +5 -0
- data/doc/release_notes/0_19_0.md +39 -0
- data/doc/release_notes/0_19_1.md +5 -0
- data/doc/release_notes/0_19_2.md +7 -0
- data/doc/release_notes/0_19_3.md +6 -0
- data/doc/release_notes/0_19_4.md +14 -0
- data/doc/release_notes/0_19_5.md +13 -0
- data/doc/release_notes/0_19_6.md +5 -0
- data/doc/release_notes/0_19_7.md +5 -0
- data/doc/release_notes/0_19_8.md +5 -0
- data/doc/release_notes/0_1_0.md +9 -0
- data/doc/release_notes/0_20_0.md +36 -0
- data/doc/release_notes/0_20_1.md +5 -0
- data/doc/release_notes/0_20_2.md +7 -0
- data/doc/release_notes/0_20_3.md +6 -0
- data/doc/release_notes/0_20_4.md +17 -0
- data/doc/release_notes/0_20_5.md +3 -0
- data/doc/release_notes/0_21_0.md +96 -0
- data/doc/release_notes/0_21_1.md +12 -0
- data/doc/release_notes/0_22_0.md +13 -0
- data/doc/release_notes/0_22_1.md +11 -0
- data/doc/release_notes/0_22_2.md +5 -0
- data/doc/release_notes/0_22_3.md +55 -0
- data/doc/release_notes/0_22_4.md +6 -0
- data/doc/release_notes/0_22_5.md +6 -0
- data/doc/release_notes/0_23_0.md +42 -0
- data/doc/release_notes/0_23_1.md +5 -0
- data/doc/release_notes/0_23_2.md +5 -0
- data/doc/release_notes/0_23_3.md +6 -0
- data/doc/release_notes/0_23_4.md +5 -0
- data/doc/release_notes/0_24_0.md +48 -0
- data/doc/release_notes/0_24_1.md +12 -0
- data/doc/release_notes/0_24_2.md +12 -0
- data/doc/release_notes/0_24_3.md +12 -0
- data/doc/release_notes/0_24_4.md +18 -0
- data/doc/release_notes/0_24_5.md +6 -0
- data/doc/release_notes/0_24_6.md +5 -0
- data/doc/release_notes/0_24_7.md +10 -0
- data/doc/release_notes/0_2_0.md +5 -0
- data/doc/release_notes/0_2_1.md +16 -0
- data/doc/release_notes/0_3_0.md +12 -0
- data/doc/release_notes/0_3_1.md +6 -0
- data/doc/release_notes/0_4_0.md +51 -0
- data/doc/release_notes/0_4_1.md +3 -0
- data/doc/release_notes/0_5_0.md +15 -0
- data/doc/release_notes/0_5_1.md +14 -0
- data/doc/release_notes/0_6_0.md +5 -0
- data/doc/release_notes/0_6_1.md +6 -0
- data/doc/release_notes/0_6_2.md +6 -0
- data/doc/release_notes/0_6_3.md +13 -0
- data/doc/release_notes/0_6_4.md +21 -0
- data/doc/release_notes/0_6_5.md +22 -0
- data/doc/release_notes/0_6_6.md +19 -0
- data/doc/release_notes/0_6_7.md +5 -0
- data/doc/release_notes/0_7_0.md +46 -0
- data/doc/release_notes/0_8_0.md +27 -0
- data/doc/release_notes/0_8_1.md +8 -0
- data/doc/release_notes/0_8_2.md +7 -0
- data/doc/release_notes/0_9_0.md +38 -0
- data/doc/release_notes/1_0_0.md +60 -0
- data/doc/release_notes/1_0_1.md +5 -0
- data/doc/release_notes/1_0_2.md +7 -0
- data/doc/release_notes/1_1_0.md +32 -0
- data/doc/release_notes/1_1_1.md +17 -0
- data/doc/release_notes/1_1_2.md +12 -0
- data/doc/release_notes/1_1_3.md +18 -0
- data/doc/release_notes/1_1_4.md +6 -0
- data/doc/release_notes/1_1_5.md +12 -0
- data/doc/release_notes/1_2_0.md +49 -0
- data/doc/release_notes/1_2_1.md +6 -0
- data/doc/release_notes/1_2_2.md +10 -0
- data/doc/release_notes/1_2_3.md +16 -0
- data/doc/release_notes/1_2_4.md +8 -0
- data/doc/release_notes/1_2_5.md +7 -0
- data/doc/release_notes/1_2_6.md +13 -0
- data/doc/release_notes/1_3_0.md +18 -0
- data/doc/release_notes/1_3_1.md +17 -0
- data/doc/release_notes/1_3_2.md +6 -0
- data/doc/release_notes/1_3_3.md +5 -0
- data/doc/release_notes/1_3_4.md +6 -0
- data/doc/release_notes/1_4_0.md +43 -0
- data/doc/release_notes/1_4_1.md +19 -0
- data/doc/release_notes/1_4_2.md +20 -0
- data/doc/release_notes/1_4_3.md +11 -0
- data/doc/release_notes/1_4_4.md +14 -0
- data/doc/release_notes/1_5_0.md +126 -0
- data/doc/release_notes/1_5_1.md +6 -0
- data/doc/release_notes/1_6_0.md +50 -0
- data/doc/release_notes/1_6_1.md +17 -0
- data/doc/release_notes/1_6_2.md +11 -0
- data/lib/httpx/adapters/datadog.rb +359 -0
- data/lib/httpx/adapters/faraday.rb +303 -0
- data/lib/httpx/adapters/sentry.rb +121 -0
- data/lib/httpx/adapters/webmock.rb +175 -0
- data/lib/httpx/altsvc.rb +163 -0
- data/lib/httpx/base64.rb +27 -0
- data/lib/httpx/buffer.rb +61 -0
- data/lib/httpx/callbacks.rb +35 -0
- data/lib/httpx/chainable.rb +106 -0
- data/lib/httpx/connection/http1.rb +399 -0
- data/lib/httpx/connection/http2.rb +468 -0
- data/lib/httpx/connection.rb +954 -0
- data/lib/httpx/domain_name.rb +145 -0
- data/lib/httpx/errors.rb +111 -0
- data/lib/httpx/extensions.rb +59 -0
- data/lib/httpx/headers.rb +176 -0
- data/lib/httpx/io/ssl.rb +163 -0
- data/lib/httpx/io/tcp.rb +239 -0
- data/lib/httpx/io/udp.rb +62 -0
- data/lib/httpx/io/unix.rb +71 -0
- data/lib/httpx/io.rb +11 -0
- data/lib/httpx/loggable.rb +56 -0
- data/lib/httpx/options.rb +463 -0
- data/lib/httpx/parser/http1.rb +186 -0
- data/lib/httpx/plugins/auth/basic.rb +20 -0
- data/lib/httpx/plugins/auth/digest.rb +102 -0
- data/lib/httpx/plugins/auth/ntlm.rb +35 -0
- data/lib/httpx/plugins/auth/socks5.rb +22 -0
- data/lib/httpx/plugins/auth.rb +25 -0
- data/lib/httpx/plugins/aws_sdk_authentication.rb +111 -0
- data/lib/httpx/plugins/aws_sigv4.rb +239 -0
- data/lib/httpx/plugins/basic_auth.rb +29 -0
- data/lib/httpx/plugins/brotli.rb +50 -0
- data/lib/httpx/plugins/callbacks.rb +127 -0
- data/lib/httpx/plugins/circuit_breaker/circuit.rb +100 -0
- data/lib/httpx/plugins/circuit_breaker/circuit_store.rb +53 -0
- data/lib/httpx/plugins/circuit_breaker.rb +147 -0
- data/lib/httpx/plugins/content_digest.rb +204 -0
- data/lib/httpx/plugins/cookies/cookie.rb +174 -0
- data/lib/httpx/plugins/cookies/jar.rb +95 -0
- data/lib/httpx/plugins/cookies/set_cookie_parser.rb +143 -0
- data/lib/httpx/plugins/cookies.rb +107 -0
- data/lib/httpx/plugins/digest_auth.rb +67 -0
- data/lib/httpx/plugins/expect.rb +120 -0
- data/lib/httpx/plugins/fiber_concurrency.rb +195 -0
- data/lib/httpx/plugins/follow_redirects.rb +233 -0
- data/lib/httpx/plugins/grpc/call.rb +63 -0
- data/lib/httpx/plugins/grpc/grpc_encoding.rb +90 -0
- data/lib/httpx/plugins/grpc/message.rb +55 -0
- data/lib/httpx/plugins/grpc.rb +282 -0
- data/lib/httpx/plugins/h2c.rb +127 -0
- data/lib/httpx/plugins/internal_telemetry.rb +107 -0
- data/lib/httpx/plugins/ntlm_auth.rb +62 -0
- data/lib/httpx/plugins/oauth.rb +183 -0
- data/lib/httpx/plugins/persistent.rb +82 -0
- data/lib/httpx/plugins/proxy/http.rb +184 -0
- data/lib/httpx/plugins/proxy/socks4.rb +135 -0
- data/lib/httpx/plugins/proxy/socks5.rb +194 -0
- data/lib/httpx/plugins/proxy/ssh.rb +94 -0
- data/lib/httpx/plugins/proxy.rb +349 -0
- data/lib/httpx/plugins/push_promise.rb +81 -0
- data/lib/httpx/plugins/query.rb +35 -0
- data/lib/httpx/plugins/rate_limiter.rb +55 -0
- data/lib/httpx/plugins/response_cache/file_store.rb +140 -0
- data/lib/httpx/plugins/response_cache/store.rb +33 -0
- data/lib/httpx/plugins/response_cache.rb +333 -0
- data/lib/httpx/plugins/retries.rb +230 -0
- data/lib/httpx/plugins/ssrf_filter.rb +145 -0
- data/lib/httpx/plugins/stream.rb +183 -0
- data/lib/httpx/plugins/stream_bidi.rb +315 -0
- data/lib/httpx/plugins/upgrade/h2.rb +64 -0
- data/lib/httpx/plugins/upgrade.rb +86 -0
- data/lib/httpx/plugins/webdav.rb +86 -0
- data/lib/httpx/plugins/xml.rb +76 -0
- data/lib/httpx/pmatch_extensions.rb +33 -0
- data/lib/httpx/pool.rb +190 -0
- data/lib/httpx/punycode.rb +22 -0
- data/lib/httpx/request/body.rb +158 -0
- data/lib/httpx/request.rb +328 -0
- data/lib/httpx/resolver/entry.rb +30 -0
- data/lib/httpx/resolver/https.rb +256 -0
- data/lib/httpx/resolver/multi.rb +102 -0
- data/lib/httpx/resolver/native.rb +547 -0
- data/lib/httpx/resolver/resolver.rb +173 -0
- data/lib/httpx/resolver/system.rb +255 -0
- data/lib/httpx/resolver.rb +189 -0
- data/lib/httpx/response/body.rb +242 -0
- data/lib/httpx/response/buffer.rb +115 -0
- data/lib/httpx/response.rb +304 -0
- data/lib/httpx/selector.rb +282 -0
- data/lib/httpx/session.rb +612 -0
- data/lib/httpx/session_extensions.rb +30 -0
- data/lib/httpx/timers.rb +133 -0
- data/lib/httpx/transcoder/body.rb +43 -0
- data/lib/httpx/transcoder/chunker.rb +115 -0
- data/lib/httpx/transcoder/deflate.rb +37 -0
- data/lib/httpx/transcoder/form.rb +68 -0
- data/lib/httpx/transcoder/gzip.rb +71 -0
- data/lib/httpx/transcoder/json.rb +71 -0
- data/lib/httpx/transcoder/multipart/decoder.rb +141 -0
- data/lib/httpx/transcoder/multipart/encoder.rb +120 -0
- data/lib/httpx/transcoder/multipart/mime_type_detector.rb +78 -0
- data/lib/httpx/transcoder/multipart/part.rb +35 -0
- data/lib/httpx/transcoder/multipart.rb +31 -0
- data/lib/httpx/transcoder/utils/body_reader.rb +46 -0
- data/lib/httpx/transcoder/utils/deflater.rb +75 -0
- data/lib/httpx/transcoder.rb +91 -0
- data/lib/httpx/utils.rb +75 -0
- data/lib/httpx/version.rb +5 -0
- data/lib/httpx.rb +66 -0
- data/sig/altsvc.rbs +33 -0
- data/sig/buffer.rbs +27 -0
- data/sig/callbacks.rbs +15 -0
- data/sig/chainable.rbs +55 -0
- data/sig/connection/http1.rbs +85 -0
- data/sig/connection/http2.rbs +116 -0
- data/sig/connection.rbs +169 -0
- data/sig/domain_name.rbs +17 -0
- data/sig/errors.rbs +69 -0
- data/sig/headers.rbs +49 -0
- data/sig/httpx.rbs +27 -0
- data/sig/io/ssl.rbs +27 -0
- data/sig/io/tcp.rbs +72 -0
- data/sig/io/udp.rbs +25 -0
- data/sig/io/unix.rbs +26 -0
- data/sig/io.rbs +3 -0
- data/sig/loggable.rbs +17 -0
- data/sig/options.rbs +202 -0
- data/sig/parser/http1.rbs +59 -0
- data/sig/plugins/auth/basic.rbs +17 -0
- data/sig/plugins/auth/digest.rbs +25 -0
- data/sig/plugins/auth/ntlm.rbs +20 -0
- data/sig/plugins/auth/socks5.rbs +18 -0
- data/sig/plugins/auth.rbs +13 -0
- data/sig/plugins/aws_sdk_authentication.rbs +43 -0
- data/sig/plugins/aws_sigv4.rbs +78 -0
- data/sig/plugins/basic_auth.rbs +15 -0
- data/sig/plugins/brotli.rbs +22 -0
- data/sig/plugins/callbacks.rbs +38 -0
- data/sig/plugins/circuit_breaker.rbs +71 -0
- data/sig/plugins/compression.rbs +57 -0
- data/sig/plugins/content_digest.rbs +51 -0
- data/sig/plugins/cookies/cookie.rbs +55 -0
- data/sig/plugins/cookies/jar.rbs +26 -0
- data/sig/plugins/cookies/set_cookie_parser.rbs +22 -0
- data/sig/plugins/cookies.rbs +28 -0
- data/sig/plugins/digest_auth.rbs +21 -0
- data/sig/plugins/expect.rbs +15 -0
- data/sig/plugins/fiber_concurrency.rbs +51 -0
- data/sig/plugins/follow_redirects.rbs +47 -0
- data/sig/plugins/grpc/call.rbs +23 -0
- data/sig/plugins/grpc/grpc_encoding.rbs +37 -0
- data/sig/plugins/grpc/message.rbs +17 -0
- data/sig/plugins/grpc.rbs +65 -0
- data/sig/plugins/h2c.rbs +27 -0
- data/sig/plugins/ntlm_auth.rbs +21 -0
- data/sig/plugins/oauth.rbs +68 -0
- data/sig/plugins/persistent.rbs +14 -0
- data/sig/plugins/proxy/http.rbs +30 -0
- data/sig/plugins/proxy/socks4.rbs +37 -0
- data/sig/plugins/proxy/socks5.rbs +49 -0
- data/sig/plugins/proxy/ssh.rbs +18 -0
- data/sig/plugins/proxy.rbs +70 -0
- data/sig/plugins/push_promise.rbs +23 -0
- data/sig/plugins/query.rbs +18 -0
- data/sig/plugins/rate_limiter.rbs +13 -0
- data/sig/plugins/response_cache/file_store.rbs +19 -0
- data/sig/plugins/response_cache/store.rbs +13 -0
- data/sig/plugins/response_cache.rbs +86 -0
- data/sig/plugins/retries.rbs +66 -0
- data/sig/plugins/ssrf_filter.rbs +26 -0
- data/sig/plugins/stream.rbs +54 -0
- data/sig/plugins/stream_bidi.rbs +68 -0
- data/sig/plugins/upgrade/h2.rbs +9 -0
- data/sig/plugins/upgrade.rbs +29 -0
- data/sig/plugins/webdav.rbs +23 -0
- data/sig/plugins/xml.rbs +37 -0
- data/sig/pool.rbs +51 -0
- data/sig/punycode.rbs +5 -0
- data/sig/request/body.rbs +34 -0
- data/sig/request.rbs +88 -0
- data/sig/resolver/entry.rbs +13 -0
- data/sig/resolver/https.rbs +45 -0
- data/sig/resolver/multi.rbs +32 -0
- data/sig/resolver/native.rbs +74 -0
- data/sig/resolver/resolver.rbs +64 -0
- data/sig/resolver/system.rbs +34 -0
- data/sig/resolver.rbs +48 -0
- data/sig/response/body.rbs +52 -0
- data/sig/response/buffer.rbs +23 -0
- data/sig/response.rbs +103 -0
- data/sig/selector.rbs +68 -0
- data/sig/session.rbs +104 -0
- data/sig/timers.rbs +54 -0
- data/sig/transcoder/body.rbs +24 -0
- data/sig/transcoder/chunker.rbs +49 -0
- data/sig/transcoder/deflate.rbs +12 -0
- data/sig/transcoder/form.rbs +34 -0
- data/sig/transcoder/gzip.rbs +27 -0
- data/sig/transcoder/json.rbs +28 -0
- data/sig/transcoder/multipart.rbs +103 -0
- data/sig/transcoder/utils/body_reader.rbs +15 -0
- data/sig/transcoder/utils/deflater.rbs +28 -0
- data/sig/transcoder.rbs +43 -0
- data/sig/utils.rbs +19 -0
- metadata +518 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# 0.12.0
|
|
2
|
+
|
|
3
|
+
## Features
|
|
4
|
+
|
|
5
|
+
### AWS Sigv4 Authentication Plugin
|
|
6
|
+
|
|
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
|
+
|
|
9
|
+
See how to use it here: https://gitlab.com/os85/httpx/-/wikis/AWS-Sigv4#sessionaws_sigv4_authentication
|
|
10
|
+
|
|
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
|
+
|
|
13
|
+
See how to use it here: https://gitlab.com/os85/httpx/-/wikis/AWS-Sigv4#sessionaws_sdk_authentication
|
|
14
|
+
|
|
15
|
+
Other FAQ: https://gitlab.com/os85/httpx/-/wikis/AWS-Sigv4#faqs
|
|
16
|
+
|
|
17
|
+
### HTTP/2 support for JRuby
|
|
18
|
+
|
|
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
|
+
|
|
21
|
+
See how to use it here: https://gitlab.com/os85/httpx/-/wikis/JRuby-Truffleruby-Other-Rubies#http2
|
|
22
|
+
|
|
23
|
+
## Improvements
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### truffleruby support
|
|
27
|
+
|
|
28
|
+
`httpx` supports and tests against `truffleruby` (known to run tests since v20.3, passing all tests since v21).
|
|
29
|
+
|
|
30
|
+
### Performance
|
|
31
|
+
|
|
32
|
+
Several optimizations were introduced:
|
|
33
|
+
|
|
34
|
+
* Reduction in read/write system calls;
|
|
35
|
+
* more usage of `String#byteslice` in parsing (instead of string mutation);
|
|
36
|
+
* Avoid selection on connections with no outstanding requests;
|
|
37
|
+
|
|
38
|
+
They all contributed to a massive performance improvement, itself reflected in test runs, which need half the time they used to to complete.
|
|
39
|
+
|
|
40
|
+
### APIs
|
|
41
|
+
|
|
42
|
+
* `HTTPX::ErrorResponse#to_s` now uses the exception full message, instead of just the backtrace.
|
|
43
|
+
|
|
44
|
+
## Bugfixes
|
|
45
|
+
|
|
46
|
+
* HTTP/2 stream protocol errors do not cause the process to hang (instead, error responnses are yielded);
|
|
47
|
+
* Fixed body stream bugs on retries when error causing retry would happen mid-transfer;
|
|
48
|
+
* Fixed `:multipart` plugin body rewind on retries to start the transfer from the beginning;
|
|
49
|
+
* Fixed auto-load of `:proxy` plugin when `HTTPS_PROXY` or `HTTP_PROXY` is set;
|
|
50
|
+
* Errno::EPIPE errors mid transfer now cause `httpx` to read from the server and get the appropriate HTTP error response;
|
|
51
|
+
* Make sure that all requests have an error responnse if the error happens early;
|
|
52
|
+
* Fixed TCP handshake Errno::INPROGRESS handling inside TLS connnections, which was causing the process to hang in a high handshake contention scenario;
|
|
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
|
+
* Fixed double event registry for DoH resolvers;
|
|
55
|
+
*
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# 0.13.0
|
|
2
|
+
|
|
3
|
+
## Features
|
|
4
|
+
|
|
5
|
+
### Upgrade plugin
|
|
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/os85/httpx/-/blob/master/test/support/requests/plugins/upgrade.rb))
|
|
8
|
+
|
|
9
|
+
You can read more about the `:upgrade` plugin in the [wiki](https://os85.gitlab.io/httpx/wiki/Connection-Upgrade).
|
|
10
|
+
|
|
11
|
+
It's the basis of two plugins:
|
|
12
|
+
|
|
13
|
+
#### `:h2c`
|
|
14
|
+
|
|
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
|
+
|
|
17
|
+
https://os85.gitlab.io/httpx/wiki/Connection-Upgrade#h2c
|
|
18
|
+
|
|
19
|
+
#### `:upgrade/h2`
|
|
20
|
+
|
|
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
|
+
|
|
23
|
+
https://os85.gitlab.io/httpx/wiki/Connection-Upgrade#h2
|
|
24
|
+
|
|
25
|
+
### `:addresses` option
|
|
26
|
+
|
|
27
|
+
The `:addresses` option is now available. You can use it to pass a list of IPs to connect to:
|
|
28
|
+
|
|
29
|
+
```ruby
|
|
30
|
+
# will not resolve example.com, and instead connect to one of the IPs passed.
|
|
31
|
+
HTTPX.get("http://example.com", addresses: %w[172.5.3.1 172.5.3.2]))
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
You should also use it to connect to HTTP servers bound to a UNIX socket, in which case you'll have to provide a path:
|
|
35
|
+
|
|
36
|
+
```ruby
|
|
37
|
+
HTTPX.get("http://example.com", transport: "unix", addresses: %w[/path/to/usocket]))
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
The `:transport_options` are therefore deprecated, and will be moved in a major version.
|
|
41
|
+
|
|
42
|
+
## Improvements
|
|
43
|
+
|
|
44
|
+
Some internal improvements that allow certain plugins not to "leak" globally, such as the `:compression` plugin, which used to enable compression for all the `httpx` sessions from the same process. It doesn't anymore.
|
|
45
|
+
|
|
46
|
+
Using exceptionless nonblocking connect calls in the supported rubies.
|
|
47
|
+
|
|
48
|
+
Removed unneeded APIs around the Options object (`with_` methods, or the defined options list).
|
|
49
|
+
|
|
50
|
+
## Bugfixes
|
|
51
|
+
|
|
52
|
+
HTTP/1.1 persistent connections were closing after each request after the max requests was reached. It's fixed, and the new connection will also be persistent.
|
|
53
|
+
|
|
54
|
+
When passing open IO objects for origins (the `:io` option), `httpx` was still trying to resolve the origin's domain. This not only didn't make sense, it broke if the domain is unresolvable. It has been fixed.
|
|
55
|
+
|
|
56
|
+
Fixed usage of `:io` option when passed an "authority/io" hash.
|
|
57
|
+
|
|
58
|
+
Fixing some issues around trying to connnect to the next available IPAddress when the previous one was unreachable or ETIMEDOUT.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# 0.13.2
|
|
2
|
+
|
|
3
|
+
## Improvements
|
|
4
|
+
|
|
5
|
+
`UDPSocket#sendmsg_nonblock` is now used in the native resolver.
|
|
6
|
+
|
|
7
|
+
## Bugfixes
|
|
8
|
+
|
|
9
|
+
Usage in Windows was buggy, resulting in `Errno::EINVAL` during DNS resolving, when using the native resolver. This was due to a discrepancy between `recvfrom` behaviour in WS Sockets and Linux Sockets. This was fixed by making we the UDP socket never tries to receive before a DNS query has been actually sent.
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# 0.14.0
|
|
2
|
+
|
|
3
|
+
## Features
|
|
4
|
+
|
|
5
|
+
### GRPC plugin
|
|
6
|
+
|
|
7
|
+
A new plugin, `:grpc`, is now available. This plugin provides a simple DSL to build GRPC services and performing calls using `httpx` under the hood.
|
|
8
|
+
|
|
9
|
+
Example:
|
|
10
|
+
|
|
11
|
+
```ruby
|
|
12
|
+
require "httpx"
|
|
13
|
+
|
|
14
|
+
grpc = HTTPX.plugin(:grpc)
|
|
15
|
+
helloworld_stub = grpc.build_stub("localhost:4545")
|
|
16
|
+
helloworld_svc = helloworld_stub.rpc(:SayHello, HelloRequest, HelloReply)
|
|
17
|
+
result = helloworld_svc.say_hello(HelloRequest.new(name: "Jack")) #=> HelloReply: "Hello Jack"
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
You can read more about the `:grpc` plugin in the [wiki](https://os85.gitlab.io/httpx/wiki/GRPC).
|
|
21
|
+
|
|
22
|
+
### :origin
|
|
23
|
+
|
|
24
|
+
A new `:origin` option is available. You can use it for setting a base URL for subsequent relative paths on that session:
|
|
25
|
+
|
|
26
|
+
```ruby
|
|
27
|
+
HTTPX.get("/httpbin/get") #=> HTTPX::Error: invalid URI: /httpbin/get
|
|
28
|
+
|
|
29
|
+
httpbin = HTTPX.with(origin: "https://nghttp2.org")
|
|
30
|
+
httpbin.get("/httpbin/get") #=> #<Response:5420 HTTP/2.0 @status=200 ....
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**Note!** The origin is **not** for setting base paths, i.e. if you pass it a relative path, it'll be filtered out in subsequent requests (`HTTPX.with(origin: "https://nghttp2.org/httpbin")` will still use only `"https://nghttp2.org"`).
|
|
34
|
+
|
|
35
|
+
## Improvements
|
|
36
|
+
|
|
37
|
+
* setting an unexpected option will now raise an `HTTPX::Error` with an helpful message, instead of a confusing `NoMethodError`:
|
|
38
|
+
|
|
39
|
+
```ruby
|
|
40
|
+
HTTPX.with(foo: "bar")
|
|
41
|
+
# before
|
|
42
|
+
#=> NoMethodError
|
|
43
|
+
# after
|
|
44
|
+
#=> HTTPX::Error: unknown option: foo
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
* `HTTPX::Options#def_option` (which can be used for setting custom plugin options) can now be passed a full body string (where the argument is `value`), although it still support the block form. This is the recommended approach, as the block form is based on `define_method`, which would make clients unusable inside ractors.
|
|
49
|
+
|
|
50
|
+
* Added support for `:wait_for_handshake` under the `http2_settings` option (`false` by default). HTTP/2 connections complete the protocol handshake before requests are sent. When this option is `true`, requests get send in the initial payload, before the HTTP/2 connection is fully acknowledged.
|
|
51
|
+
|
|
52
|
+
* 441716a5ac0f7707211ebe0048f568cf0b759c3f: The `:stream` plugin has been improved to start streaming the real response as methods are called (instead of a completely separate synchronous one, which is definitely not good):
|
|
53
|
+
|
|
54
|
+
```ruby
|
|
55
|
+
session = HTTPX.plugin(:stream)
|
|
56
|
+
response = session.get(build_uri("/stream/3"), stream: true)
|
|
57
|
+
|
|
58
|
+
# before
|
|
59
|
+
response.status # this could block indefinitely, if the request truly streams infinitely.
|
|
60
|
+
|
|
61
|
+
# after
|
|
62
|
+
response.status # sends the request, and starts streaming the response until status is available.
|
|
63
|
+
response.each {|chunk|...} # and now you can start yielding the chunks...
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
## Bugfixes
|
|
68
|
+
|
|
69
|
+
* fixed usage of the `:multipart` if `pathname` isn't loaded.
|
|
70
|
+
* fixed HTTP/2 trailers.
|
|
71
|
+
* fixed connection merges with the same origin, which was causing them to be duplicated and breaking further usage. (#125)
|
|
72
|
+
* fixed repeated session callbacks on a connection, by ensure they're set only once.
|
|
73
|
+
* fixed calculation of `content-length` for streaming or chunked compressed requests.
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
## Chore
|
|
77
|
+
|
|
78
|
+
* using ruby base container images in CI instead.
|
|
79
|
+
* using truffleruby official container image.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# 0.14.1
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
## Bugfixes
|
|
5
|
+
|
|
6
|
+
* fixed: HTTP/2-specific headers were being reused on insecure redirects, thereby creating an invalid request (#128);
|
|
7
|
+
* fixed: multipart request parts weren't using explicity set `:content_type`, instead using file mime type or "text/plain";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# 0.14.5
|
|
2
|
+
|
|
3
|
+
## Bugfixes
|
|
4
|
+
|
|
5
|
+
* After a connection had been initiated, sending multiple concurrent requests (ex: `open_httpx.request(req1, req2, req3)`) could freeze; this happened when the first request would fill the write buffer (like a file upload request), and the subsequent requests would never be buffered afterwards; this was fixed by making pending requests flushing a part of a connection's consumption loop.
|
|
6
|
+
* Fixing v0.14.1's fixed bug again; The HTTP/1 "Connection: close" header was not being set in the last possible request on a connection, due to ann off-by-one error on connection bookkeeping;
|
|
7
|
+
* HTTP/1 connections didn't respect a server-set max nunmber of requests after a reconnect; Fixed by making this accounting part of the reset process;
|
|
8
|
+
|
|
9
|
+
## Chore
|
|
10
|
+
|
|
11
|
+
* Added regression test suite, which reproduce reported bugs before the fix (backported all 0.14.x releases here)
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# 0.15.0
|
|
2
|
+
|
|
3
|
+
## Features
|
|
4
|
+
|
|
5
|
+
### HTTP response pattern-matching (ruby 3 only)
|
|
6
|
+
|
|
7
|
+
You can now apply pattern matching in responses:
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
case response = HTTPX.get("https://google.com")
|
|
11
|
+
in { status: 200..399, headers: [*, ["x-special-token", token], *], body: }
|
|
12
|
+
puts "success: #{body.to_s}"
|
|
13
|
+
in { status: 400..499, body: }
|
|
14
|
+
puts "client error: #{body.to_s}"
|
|
15
|
+
in { status: 500.., body: }
|
|
16
|
+
puts "server error: #{body.to_s}"
|
|
17
|
+
in { error: error }
|
|
18
|
+
puts "error: #{error.message}"
|
|
19
|
+
else
|
|
20
|
+
raise "unexpected: #{response}"
|
|
21
|
+
end
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### NTLM Authentication
|
|
25
|
+
|
|
26
|
+
A new plugin, `:ntml_authentication`, is now available. Like the name suggests, it allows authenticating requests via [NTLM](https://docs.microsoft.com/en-us/windows-server/security/kerberos/ntlm-overview).
|
|
27
|
+
|
|
28
|
+
```ruby
|
|
29
|
+
ntlm_http = HTTPX.plugin(:ntlm_authentication)
|
|
30
|
+
|
|
31
|
+
ntlm.ntlm_authentication("user", "password").get("http://protected-area-requiring-ntlm.net")
|
|
32
|
+
# or for a specific domain
|
|
33
|
+
ntlm.ntlm_authentication("user", "password", "Domain\\User").get("http://protected-area-requiring-ntlm.net")
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Improvemennts
|
|
37
|
+
|
|
38
|
+
A new timeout option, `settings_timeout`, is supported for the HTTP/2 handshake; after the TCP and TLS handshakes are complete, and initiating the HTTP/2 handshake, the client terminates the connection with SETTINGS_TIMEOUT error code, if it doesn't receive the server settings for the amount of seconds set in `settings_timeout` (by default, 10 seconds).
|
|
39
|
+
|
|
40
|
+
```ruby
|
|
41
|
+
# if you want to change
|
|
42
|
+
HTTPX.with(timeout: {settings_timeout: 5})....
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
IDNA 2008 support is now possibly, by integrating [idnx](https://github.com/HoneyryderChuck/idnx) into your dependencies:
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
```ruby
|
|
50
|
+
# in Gemfile
|
|
51
|
+
gem "httpx"
|
|
52
|
+
gem "idnx"
|
|
53
|
+
```
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# 0.15.1
|
|
2
|
+
|
|
3
|
+
## Bugfixes
|
|
4
|
+
|
|
5
|
+
Fixed HTTP/1 connection accounting on requests:
|
|
6
|
+
|
|
7
|
+
* when persistent, Connection: close will be set based on the request position on the batch against the allowed requests on the open connection.
|
|
8
|
+
* when not persistent, Connnection: close will be set on the last request of the batch, being the batch a subset based on allowed requests, or the whole of it.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# 0.15.2
|
|
2
|
+
|
|
3
|
+
## Bugfixes
|
|
4
|
+
|
|
5
|
+
* Fixed cookie management for same-keys: before the fix, cookies with same-key, same-domain and same-path were all being sent in subsequent requests, which violates RFC 6265 - 5.4 . As of now, only the last valid cookie for a given key/domain/path will be kept, evicting the others.
|
|
6
|
+
|
|
7
|
+
## Chore
|
|
8
|
+
|
|
9
|
+
* debug logs were inserting ASCII code string wrappers, even when no color was set. It nonw only sends the plain string.
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# 0.16.0
|
|
2
|
+
|
|
3
|
+
## Features
|
|
4
|
+
|
|
5
|
+
### Response::Body#to_s does not clear the internal buffer
|
|
6
|
+
|
|
7
|
+
It's well documented that the response body should be treated as a file, and that calling `.to_s` on a response should be done only once, and the user should not expect the same call to return the same response body again, while suggesting that the first call should be cached in a variable in case it's needed:
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
response = HTTPX.get("https://google.com")
|
|
11
|
+
body = response.body.to_s #=> "<html ...."
|
|
12
|
+
response.body.to_s #=> ""
|
|
13
|
+
|
|
14
|
+
# thankfully,it's cached in the body var there.
|
|
15
|
+
```
|
|
16
|
+
|
|
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
|
+
|
|
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
|
+
|
|
21
|
+
So now, you can call `.to_s` how many times you want!
|
|
22
|
+
|
|
23
|
+
```ruby
|
|
24
|
+
response = HTTPX.get("https://google.com")
|
|
25
|
+
body = response.body.to_s #=> "<html ...."
|
|
26
|
+
response.body.to_s #=> "<html ....", still here!
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Some optimizations were done around how the body is carried forward, and bodies buffered in files will now get properly garbage collected and not leak descriptors behind when users forget to call `.close`.
|
|
30
|
+
|
|
31
|
+
### grpc plugin improvements
|
|
32
|
+
|
|
33
|
+
##### build fully-enabled stub from grpc service
|
|
34
|
+
|
|
35
|
+
The `:grpc` plugin can now build fully-loaded stubs from existing GRPC generic services.
|
|
36
|
+
|
|
37
|
+
GRPC stubs could be a bit tedious to write when compared to what the `grpc` gem offers, which is, auto-generation from ruby service stubs from protobuf definitions:
|
|
38
|
+
|
|
39
|
+
```ruby
|
|
40
|
+
# service generated from the command:
|
|
41
|
+
#
|
|
42
|
+
# > grpc_tools_ruby_protoc -I ../../protos --ruby_out=../lib --grpc_out=../lib ../../protos/route_guide.proto
|
|
43
|
+
#
|
|
44
|
+
require "route_guide_services_pb.rb"
|
|
45
|
+
|
|
46
|
+
# with httpx, before 0.16
|
|
47
|
+
stub = HTTPX.plugin(:grpc).build_stub("localhost:#{server_port}", service: "RouteGuide")
|
|
48
|
+
.rpc(:GetFeature, Point, Feature)
|
|
49
|
+
.rpc(:ListFeatures, # ... and so on, all hand stitched
|
|
50
|
+
|
|
51
|
+
stub.get_feature(# ...
|
|
52
|
+
|
|
53
|
+
# with httpx 0.16
|
|
54
|
+
stub = HTTPX.plugin(:grpc).build_stub("localhost:#{server_port}", service: RouteGuide)
|
|
55
|
+
# that's it!
|
|
56
|
+
stub.get_feature(# ...
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
#### no google/protobuf direct dependency
|
|
60
|
+
|
|
61
|
+
`"google/protobuf"` is no longer assumed when using the plugin, i.e. you can use other protobuf serializers, such as https://github.com/ruby-protobuf/protobuf , which supports `jruby` (unlike the former).
|
|
62
|
+
|
|
63
|
+
### OptionsMethods for plugins
|
|
64
|
+
|
|
65
|
+
https://gitlab.com/os85/httpx/-/wikis/Custom-Plugins
|
|
66
|
+
|
|
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
|
+
|
|
69
|
+
```ruby
|
|
70
|
+
module CustomPlugin
|
|
71
|
+
module OptionsMethods
|
|
72
|
+
def option_bar(x) ; x; end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
HTTPX.plugin(CustomPlugin).with(bar: 2)
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### cookies plugin: improved jar management
|
|
80
|
+
|
|
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
|
+
|
|
83
|
+
The behaviour was fixed, and is now specced under https://gitlab.com/os85/httpx/-/blob/master/test/support/requests/plugins/cookies.rb .
|
|
84
|
+
|
|
85
|
+
## Bugfixes
|
|
86
|
+
|
|
87
|
+
* Cookies sorting in the `:cookies` plugin jar was fixed for truffleruby;
|
|
88
|
+
|
|
89
|
+
## Chore
|
|
90
|
+
|
|
91
|
+
* errors when setting options nnow raise `TypeError` instead of `HTTPX::Error`.
|
|
92
|
+
* options are now internally frozen by default, which should protect the internals against accidentally updating them;
|
|
93
|
+
* Fixed optimization around options initialization, to prevent needless allocations;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# 0.17.0
|
|
2
|
+
|
|
3
|
+
## Features
|
|
4
|
+
|
|
5
|
+
### Response mime type decoders (#json, #form)
|
|
6
|
+
|
|
7
|
+
https://gitlab.com/os85/httpx/-/wikis/Response-Handling#response-decoding
|
|
8
|
+
|
|
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
|
+
|
|
11
|
+
```ruby
|
|
12
|
+
# after HTTPX.get("https://api.smth/endpoint-returning-json")
|
|
13
|
+
response.json # same as JSON.dump(response.to_s)
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Although not yet documented, integrating custom decoders is also possible (i.e. parsing HTML with `nokogiri` or something similar).
|
|
17
|
+
|
|
18
|
+
## Improvements
|
|
19
|
+
|
|
20
|
+
### Connection: reduce interest calculations
|
|
21
|
+
|
|
22
|
+
Due to it being an intensive task, internal interest calculation in connections was reduce to the bare minimum.
|
|
23
|
+
|
|
24
|
+
### Immutable Options, internal recycling of instances, improves memory usage in the happy path
|
|
25
|
+
|
|
26
|
+
A lot of effort went into avoiding generating options objects internally whenever necessary. This means, when sending several requests with the same set of options (the most common case in `httpx` usage), internally only one object is passed around. For that, the following improvements were done:
|
|
27
|
+
|
|
28
|
+
* `Options#merge` returns the same options the the options being merged are a subset of the current set of options (b126938a6547e09b726dd64298fb488891d938e9).
|
|
29
|
+
* `Session#build_request` bypasses instantiation of options if it receives an `Options` object (which happens internally in the happy path, if users don't call `#build_request` directly) (3d549817cb41d4b904102fdc61afe3ecd9170893).
|
|
30
|
+
* Improving internal `Session` APIs to not pass around options, and instead rely on accessing request options.
|
|
31
|
+
* `Options#to_hash` does not build internal garbage arrays anymore (cc02679b804f63798f5d2136a039be1624e96ab6).
|
|
32
|
+
|
|
33
|
+
### Reduce regexp operations in the HTTP/1 parser
|
|
34
|
+
|
|
35
|
+
Some code paths in the HTTP/1 parser still using regular expressions were replaced by string operations accomplishing the same.
|
|
36
|
+
|
|
37
|
+
### HTTP/1 improvements on the complexity of connection accounting calculations
|
|
38
|
+
|
|
39
|
+
Managing open HTTP/1 connections relies on operations calculating whether there are requests waiting for completion. This relied on traversing all requests for that connectionn (O(n)); it now only checks the completion state of the first and last request of that connection, given that all requests in HTTP/1 are sequential (O(1)); this optimization brings a big improvement to persistent and pipelined requests (65261217b1270913e4bb93717e8b8dcfa775565a).
|
|
40
|
+
|
|
41
|
+
## Bugfixes
|
|
42
|
+
|
|
43
|
+
* fixing HTTP/1 protocol uncompliant exposing multiple values for the "Host" header (e435dd0534314508262184fb03d83124d89d2079).
|
|
44
|
+
|
|
45
|
+
* Custom response finalizer introduced in 0.16.0 has been reverted. It was brought to my attention that `Tempfile` implementation already takes care of the file on GC (and `httpx` was duplicating), and the approach taken in `httpx` was buggy in several ways (not tolerant to forks, never recycled finalizers...) (aa3be21c890f92a41afcc7931f01dd24cc801f7c).
|
|
46
|
+
|
|
47
|
+
## Chore
|
|
48
|
+
|
|
49
|
+
RBS Typing improvements based on latest stdlib signatures additions, such as `openssl`, `digest`, `socket` and others.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# 0.18.0
|
|
2
|
+
|
|
3
|
+
## Features
|
|
4
|
+
|
|
5
|
+
### Response Cache
|
|
6
|
+
|
|
7
|
+
https://gitlab.com/os85/httpx/-/wikis/Response-Cache
|
|
8
|
+
|
|
9
|
+
The `:response_cache` plugin handles transparent usage of HTTP caching and conditional requests to improve performance and bandwidth usage.
|
|
10
|
+
|
|
11
|
+
```ruby
|
|
12
|
+
client = HTTPX.plugin(:response_cache)
|
|
13
|
+
r1 = client.get("https://nghttp2.org/httpbin/cache")
|
|
14
|
+
r2 = client.get("https://nghttp2.org/httpbin/cache")
|
|
15
|
+
|
|
16
|
+
r1.status #=> 200
|
|
17
|
+
r2.status #=> 304
|
|
18
|
+
r1.body == r2.body #=> true
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### jitter on "retry-after"
|
|
22
|
+
|
|
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
|
+
|
|
25
|
+
You can override the jitter calculation function by using the [:retry_jitter](https://gitlab.com/os85/httpx/-/wikis/Retries#retry_jitter) option:
|
|
26
|
+
|
|
27
|
+
```ruby
|
|
28
|
+
HTTPX.plugin(:retries, retry_after: 2, retry_jitter: ->(interval) { interval + rand }) # interval is 3
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
You can opt out of this by setting `HTTPX_NO_JITTER=1` environment variable.
|
|
32
|
+
|
|
33
|
+
### Response#error
|
|
34
|
+
|
|
35
|
+
`HTTPX::Response#error` was added, to match `HTTPX::Response#error`. It returns an exception for 4xx/5xx responses (`HTTPX::HTTPError`), `nil` otherwise. It allows for end users to write such code:
|
|
36
|
+
|
|
37
|
+
```ruby
|
|
38
|
+
if (response = HTTPX.get(uri)).error
|
|
39
|
+
# success
|
|
40
|
+
else
|
|
41
|
+
#error
|
|
42
|
+
end
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Improvements
|
|
46
|
+
|
|
47
|
+
* `webmock` adapter: added support for "stub_http_request#to_timeout" (https://gitlab.com/os85/httpx/-/merge_requests/165).
|
|
48
|
+
|
|
49
|
+
## timers not a dependency
|
|
50
|
+
|
|
51
|
+
The functionality provided by the `timers` gem was replaced by a simpler custom implementation. Although powerful, its complexity was somewhat unnecessary for `httpx`'s simpler event loop, where user-defined timeouts are usually the same for a given batch of requests. The removal of `timers` reduces the number of dependencies to 1, which is `http-2-next` and is maintained by me.
|
|
52
|
+
|
|
53
|
+
## AWS plugins
|
|
54
|
+
|
|
55
|
+
* `aws_sdk_authentication` plugin: removed implementation relying on `aws-sdk-s3`, replacing it with an `aws-sdk-core` relying implementation, which only uses credentials strategies and region discovery (the whole point of this SDK is to use a minimal subset of AWS SDK).
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
## Bugfixes
|
|
59
|
+
|
|
60
|
+
* Fixed Error class declaration on response decoders when mime type is invalid (https://gitlab.com/os85/httpx/-/merge_requests/166).
|
|
61
|
+
* `ErrorResponse#to_s` now removes ANSI escape sequences from error backtraces.
|
|
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
|
+
* 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.
|
|
64
|
+
* Fixed issue where HTTP/2 streams were being closed twice (and signaling it also twice), messing connection accounting in the pool.
|
|
65
|
+
* DoH resolver was always subscribed to the default thread "connection pool", which broke scenarios were session was patched to use its custom pool; it now ensures that it subscribes to the pool it was created in.
|
|
66
|
+
* `:aws_sigv4` plugin: removed require of `aws-sdk-s3`, left there by mistake (the whole point of the plugin is to run without the AWS SDK).
|
|
67
|
+
## Chore
|
|
68
|
+
|
|
69
|
+
* `HTTPX::ErrorResponse#status` is now deprecated.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# 0.18.1
|
|
2
|
+
|
|
3
|
+
## Bugfixes
|
|
4
|
+
|
|
5
|
+
* HTTP/1.1 pipelining logs were logging the previously-buffered requests all together for each triggered request, which created some confusion for users when reporting errors. This has been fixed.
|
|
6
|
+
* HTTP/2 coalescing is now skipped when performing TLS connections with VERIFY_NONE.
|
|
7
|
+
* HTTP/2 peer GOAWAY frames will now result in a (retryable) connection error, instead of being ignored and leaving a "ghost" connection behind.
|
|
8
|
+
* fixed total timeout call which was not raising the exception.
|
|
9
|
+
|
|
10
|
+
## Chore
|
|
11
|
+
|
|
12
|
+
This gem now requires MFA-based gem releases.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# 0.18.2
|
|
2
|
+
|
|
3
|
+
## Bugfixes
|
|
4
|
+
|
|
5
|
+
* A bug was reported and fixed, whereby a persistent connection with a `:total_timeout` set was triggering the timeout and leaving the process looping indefinitely.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## Chore
|
|
9
|
+
|
|
10
|
+
The quirk of using the `:persistent` plugin with `:total_timeout` has been documented: https://gitlab.com/os85/httpx/-/wikis/Timeouts#total_timeout.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# 0.18.3
|
|
2
|
+
|
|
3
|
+
## Bugfixes
|
|
4
|
+
|
|
5
|
+
* request bodies eager-loaded from enumerables yield duped partial chunks.
|
|
6
|
+
|
|
7
|
+
An error was observed while looking at webmock integration, where requests formed via the multipart plugin were returning an empty string as body. The issue was caused by an optimization on multipart encoder, which reuses the same buffer when reading chunks. Unfortunately, these cannot be yielded the same way via IO.copy_stream, as the same (cleared) buffer will be used to generate the eager-loaded body chunks.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# 0.18.4
|
|
2
|
+
|
|
3
|
+
## Improvements
|
|
4
|
+
|
|
5
|
+
* faraday adapter: added support for `#on_data` callback in order to support [faraday streaming](https://lostisland.github.io/faraday/usage/streaming).
|
|
6
|
+
|
|
7
|
+
* multipart plugin: removed support for file mime type detection using `mime-types`. The reasoning behind it was that `mime-types` uses the filename, which is a very inaccurate detection strategy (ex: an mp4 video will be identified as `application/mp4`, instead of the correct `video/mp4`).
|
|
8
|
+
* multipart plugin: supported for file mime type detection using `marcel` and `filemagic` was added. Both use the magic header bytes, which is a more accurate strategy for file type detection.
|
|
9
|
+
|
|
10
|
+
## Bugfixes
|
|
11
|
+
|
|
12
|
+
* webmock adapter has been reimplemented to work with `httpx` plugins (such as the `:retries` plugin). Some other fixes were applied to make it work better under `vcr` (a common `webmock` extension).
|
|
13
|
+
|
|
14
|
+
* fixed the URI-related bug which was making requests stall under ruby 3.1 (still not officially testing against it).
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# 0.18.5
|
|
2
|
+
|
|
3
|
+
## Improvements
|
|
4
|
+
|
|
5
|
+
* ruby 3.1 is now officially supported.
|
|
6
|
+
* when a user sets a `Host` header for an HTTP/2 request, this will be used in the `:authority` HTTP/2 pseudo-header, instead of silently ignored (mimicking what "curl" does).
|
|
7
|
+
|
|
8
|
+
## Bugfixes
|
|
9
|
+
|
|
10
|
+
* fixed "throw outside of catch block" error happening when pipelining requests on an HTTP/1 connection and resulting in a timeout.
|