httpx 1.6.0 has been released.
```
HTTPX.get("https://gitlab.com/honeyryderchuck/httpx
<https://gitlab.com/honeyryderchuck/httpx>")
```
HTTPX is an HTTP client library for the Ruby programming language.
Among its features, it supports:
* HTTP/2 and HTTP/1.x protocol versions
* Concurrent requests by default
* Simple and chainable API
* Proxy Support (HTTP(S), CONNECT tunnel, Socks4/4a/5)
* Simple Timeout System
* Lightweight by default (require what you need)
And also:
* Compression (gzip, deflate, brotli)
* Streaming Requests
* Authentication (Basic Auth, Digest Auth, AWS Sigv4)
* Expect 100-continue
* Multipart Requests
* Cookies
* HTTP/2 Server Push
* H2C Upgrade
* Automatic follow redirects
* International Domain Names
* GRPC
* Circuit breaker
* WebDAV
* SSRF Filter
* Response caching
* HTTP/2 bidirectional streaming
* QUERY HTTP verb
* Datadog integration
* Faraday integration
* Webmock integration
* Sentry integration
Here are the updates since the last release:
# 1.6.0
## Features
### `:fiber_concurrency` plugin
While simple use cases of `httpx` being used inside a fiber scheduler (such
as [async](github.com/socketry/async)) worked, a serious of issues were
identified when connections were reused across fibers for multiple requests
(such as when using the `:persistent` plugin). The `:fiber_concurrency`
plugin fixes that, by bookkeeping which requests are being used in which
fibers in order to avoid spurious wakeups and busy loops.
This plugin is loaded by default when using the `:persistent` plugin, and
by extension the `faraday` adapter.
You can read more about it in
https://honeyryderchuck.gitlab.io/httpx/wiki/Fiber-Concurrency
## Improvements
* proxy errors are now retriable (when using the `:retries` plugin
alongside the `:proxy` plugin).
* several options improvements:
* improve initialization by caching options names in the class, which
facilitates predictable option ivar initialization, which avoids "too many
shapes" performance penalty.
* when using `HTTPX::Options#merge`, enforce usage of Hash or
`HTTPX::Options` object as the argument to merge with, instead of silently
ignoring when none of the former.
* `option_` setter methods are now private.
* all options ivars are frozen on initialize, which enforces the
immutability guarantees (**note**: in case you were relying on it not being
truly mutable, this may break your code. Try either passing immutable
values to options, or instead use procs).
* several selector loop improvements:
* move selectable checks a layer above to avoid calling `IO.select` with
a single socket at all costs.
* Improve connection interest calculation to reduce spurious wakeups.
* skip early when finding closed selectables
* improve connection initialization to avoid "too many shapes" performance
penalty.
* Plugins are now able to extend the functionality of both HTTP1 and HTTP2
connections, as well as resolvers.
* see instructions in the [custom lugins wiki](
https://gitlab.com/os85/httpx/-/wikis/Custom-Plugins)
* IP addresses which have expired their TTL (from the respective DNS
answer) will be invalidated and force a new name resolution on operations
requiring it, such as reconnections or cache lookups.
* connections are removed from errors which store it internally (for
internal purposes) before returning the respective error response (so that
it can be garbage collected).
## Bugfixes
* remove check for non-unique local ipv6 which was preventing Happy
Eyeballs v2 from kicking in.
* recover from "network unreachable" errors triggered by using a cached IP.
* dealing with requests which are rerouted for retries in the main session
response handling loop.
* `datadog` adapter: compatibility with support versions under 1.13.0 is
working again.
* http2 connection: fix calculation when connection closes and there's no
termination handshake
* `callback_for`: check for existence of ivar `@callbacks` first.
* native resolver: do not buffer DNS query if waiting on a previous reply
(even across fibers).
* http2: do not allow deactivating connections which finished all requests
but are still waiting for the ack of the PING frame (which can happen in a
multi-fiber usage scenario).
* pool: fix when connection is acquired after waiting on it; return it
immediately, instead of bookkeeping on `:max_connections` (when defined).
* session: fix deactivation flow, when connections get deregistered from
selector and removed from the array being iterated on.
* `:proxy` plugin: fix ssl reconnection such as, on close, the IO
downgrades to the respective tcp socket, so that reconnection handshake
starts from scratch with the original IO.
* `:persistent` plugin: calling `HTTPX::Session#close` will close selectors
from other threads (instead of just the thread it was called on).
* `:callbacks` plugin: propagate callbacks to "derived-via `.plugin`"
sessions.
* `:callbacks` plugin: do not trigger the `on_response_completed` callback
if there was an error (as that's what the `on_request_error` callback is
for).
## Chore
* decoupled form and multipart transcoders, moved "form or multipart"
check to request body.
# 1.5.1
## Bugfixes
* connection errors on persistent connections which have just been checked
out from the pool no longer account for retries bookkeeping; the assumption
should be that, if a connection has been checked into the pool in an open
state, chances are, when it eventually gets checked out, it may be corrupt.
This issue was more exacerbated in `:persistent` plugin connections, which
by design have a retry of 1, thus failing often immediately after check out
without a legitimate request try.
* native resolver: fix issue with process interrupts during DNS request,
which caused a busy loop when closing the selector.
On 2013-10-9 6:22 pm, Andreas Schmidt wrote:
> Hi,
>
> I recently had to inflate a malformed compressed (RFC1950) string. The
> zlib magicbytes as well as the adler32-crc were missing.
> I tried different ways to inflate the string. First I prepended the zlib
> magic byte "\x78\x01" without success. 2nd I used the Zlib::Inflate
> object and pipedin the magicbytes which worked to my surprise.
> Can anybody tell me the difference of the internal behaviour of zlib, or
> is it a bug?
You'll probably need to check zlib more than in Ruby... but my _guess_
is that when you add the bytes and call inflate, it expects the data to
be well-formed incl the CRC.
However, when you stream it in, it is probably deflating the stream as
it gets it but when you don't supply the CRC, it is able to return what
was inflated, but is unable to confirm if the data is actually correct
since the CRC has not been verified.
In fact, if you see this function at https://www.zlib.net/manual.html:
ZEXTERN int ZEXPORT inflate(z_streamp strm, int flush);
> inflate decompresses as much data as possible, and stops when the
input buffer becomes empty or the output buffer becomes full. It may
introduce some output latency (reading input without producing any
output) except when forced to flush.
It adds:
> If a preset dictionary is needed after this call (see
inflateSetDictionary below), inflate sets strm->adler to the Adler-32
checksum of the dictionary chosen by the compressor and returns
Z_NEED_DICT; otherwise it sets strm->adler to the Adler-32 checksum of
all output produced so far (that is, total_out bytes) and returns Z_OK,
Z_STREAM_END or an error code as described below.
> At the end of the stream, inflate() checks that its computed Adler-32
checksum is equal to that saved by the compressor and returns
Z_STREAM_END only if the checksum is correct.
So, if it does not know that the stream has ended, it does not confirm
that checksum but returns data up to that point (till the end, in your
case).
Hope this helps.
Best regards,
Mohit.
sexp_processor version 4.17.4 has been released!
* home: <https://github.com/seattlerb/sexp_processor>
* rdoc: <http://docs.seattlerb.org/sexp_processor>
sexp_processor branches from ParseTree bringing all the generic sexp
processing tools with it. Sexp, SexpProcessor, Environment, etc... all
for your language processing pleasure.
Changes:
### 4.17.4 / 2025-09-02
This release was brought to you by ScotRail free WiFi!
* 1 minor enhancement:
* Added 3.4 to pt_testcase.rb.