1085 Commits

Author SHA1 Message Date
HoneyryderChuck
eda4ad5bc3 bumped version to 0.19.1 2022-02-11 17:56:41 +00:00
HoneyryderChuck
0e9a964fe1 fix: resolver may return a nil, which needs to be filtered out 2022-02-11 17:56:05 +00:00
HoneyryderChuck
282edc08b4 bumped version to 0.19.0 2022-02-02 11:48:06 +00:00
HoneyryderChuck
b5b0e89dd1 on Response.response=, check if it's an error before expecting to use Response API; this triggers a second exception which won't be propagated and causes a loop 2022-02-01 22:48:42 +00:00
HoneyryderChuck
6f7f7933c3 proc no lambda 2022-01-17 00:59:01 +02:00
HoneyryderChuck
037994514b reworked early_resolve to work with dual-stack
for multi-backed resolvers, resolving is attempted before sending it to
    the resolver. in this way, cached, local or ip resolves get
    propagated to the proper resolver by ip family, instead of the
    previous mess.

    the system resolver doesn't do these shenanigans (trust getaddrinfo)
2022-01-17 00:56:09 +02:00
HoneyryderChuck
4641797a7f added support for resolve timeout in the system resolver 2022-01-16 22:54:56 +02:00
HoneyryderChuck
c17a260fe8 fix: resolv with host file order + tcp connect issue
the early_resolve can't rely on separate by-family resolve logic.
Therefore, the addresses coming from there should be emitted with the
proper sort (ipv6 addresses last).

Also, fixed an issue with tcp connect where the socket wasn't being
reinitialized before the new attempt, thereby retrying to connec on the
same address that failed.
2022-01-16 22:54:56 +02:00
HoneyryderChuck
554957f6ca initial reimplementation of the system resolver, now using getaddrinfo
the ruby `resolver` library does everthing in ruby, and sequentially
(first ipv4 then ipv6 resolution). we already have native for that, and
getaddrinfo should be considered the ideal way to use DNS (potentially
in the future, it becomes the default resolver).
2022-01-16 22:54:56 +02:00
HoneyryderChuck
2940323412 implemented happy eyeballs v2 (rfc8305) for native and https resolver
Two resolver are kept (IPv6/IPv4) along in the pool, to which all
names are sent to and read from in the same pool. IPv4 resolves are
subject to a 50ms delay (as per rfc) before they're used for connecting.
IPv6 addresses have preference, in that if they arrive before the delay,
they are immediately used. If they arrive after the delay, they do not
interrupt the connection, but they'll be the next-in-line in case
connection handshake fails.

Two resolvers are kept, but the inherent Connection will be shared,
thereby sending name resolving requests to the same HTTP/2 connection in
bulk. The resolution delay logic from above also applies.

Currently handles resolving via `resolv` lib. This happens synchronously
though, so we're not there yet.
2022-01-16 22:54:56 +02:00
HoneyryderChuck
82b0a4bf28 fix: https resolver should close when no more outstanding connections are around 2022-01-16 22:54:56 +02:00
HoneyryderChuck
06b162b6ea applying a resolver manager to hold the different family type resolvers for the pool. This allows to have multiple resolvers per type, i.e. IPv6 and IPv4 2022-01-16 22:54:56 +02:00
HoneyryderChuck
6d33b5e59f adding support for tempfile sigs, other improvements 2022-01-16 22:54:56 +02:00
HoneyryderChuck
9bd73e5a22 removing uncaching of resolved names (not used anywhere) 2022-01-16 22:54:54 +02:00
HoneyryderChuck
921d1f6371 removing resolver_ios cache from pool (did not have accurate values, not really useful since selector avoid doubler registries already) 2022-01-16 22:53:36 +02:00
HoneyryderChuck
a8830681df changing resolver structure to rely on inheritance, which helps with typing 2022-01-16 22:53:36 +02:00
HoneyryderChuck
b739cc42e6 native resolver: resetting start_timeout after closing 2022-01-16 02:29:48 +02:00
HoneyryderChuck
cef4d2018b emptying buffers on native resolver cloose 2022-01-16 02:29:48 +02:00
HoneyryderChuck
cc63fae2b5 fixed deletion of timmeouts, so that CNAME resolve doesn't leave timeouts behind 2022-01-15 01:38:14 +02:00
HoneyryderChuck
59ac7d8bca fix: DEFAULT_OPTIONS option_class not set right for env proxy
When proxy plugin loads by default, Session is redefined, but the
default options still referred the original Options class. this broke
further plugins on top. Given this is a frozen variable, corners were
cut.
2022-01-15 01:38:14 +02:00
HoneyryderChuck
15a4fb83ba options: also freeze inner unfrozen vars; fixed message of resolve
timeout to include host
2022-01-15 01:38:14 +02:00
HoneyryderChuck
b9911025ba fixed linting 2022-01-14 19:07:38 +02:00
Bouke van der Bijl
6e52640bd5 Support passing options in Faraday Adapter
The options are passed on to the created Session
2022-01-14 15:48:37 +00:00
ojab
60e04412bd
Fixup mismatched indentations ruby warning 2022-01-12 13:10:55 +00:00
HoneyryderChuck
4cec75c33a bumped version to 0.18.7 2022-01-12 10:54:08 +02:00
HoneyryderChuck
a03a66eb63 fix filemagic: rewind file after mime type detection 2022-01-12 10:52:32 +02:00
HoneyryderChuck
f99abc38e2 Merge branch 'fix-filemagic' 2022-01-12 10:11:50 +02:00
HoneyryderChuck
561b7da590 bumped version to 0.18.6 2022-01-12 10:10:32 +02:00
HoneyryderChuck
e7f11604f5 added missing constant to multipart filemagic integration 2022-01-12 10:07:44 +02:00
HoneyryderChuck
22d18cecdd fixing env proxy again: options class must be looked up, as the default one was somehow cached 2022-01-08 17:48:52 +02:00
HoneyryderChuck
764ec71a4f native resolver: do not leave timeouts for alreaady resolved hosts around, affects subsequent 2022-01-08 15:22:32 +02:00
HoneyryderChuck
5c019c440f added test for testing the env var proxy defs 2022-01-08 15:09:11 +02:00
HoneyryderChuck
7da23ac89c enable connection coalescing for proxied connections 2022-01-08 15:09:11 +02:00
HoneyryderChuck
fde8ea3276 fix: do not apply timeout errors on inactive conns
when selector emits a timeout error, the full list of connections in the
pool is traversed. This is in itself not very performant, but the
problem is that the accounting is also done with connection which
weren't selected, such as the inactive connections. So we skip this for
them for now.
2022-01-07 12:26:26 +02:00
HoneyryderChuck
9aeaf437ef fix: proxy plugin #next_proxy returns a proxy options hash instead
the #next_proxy function was relying on the existence of a proxy object.
However, in the case of default proxy plugin, this is not the case, and
this is only created later.
2022-01-07 12:26:26 +02:00
HoneyryderChuck
48be2bd13a fix: proxy plugin loaad on http(s)_proxy envvar is working
the grep call was applied on an hash, instead of the keys, and was
therefore not picking up the proxy plugin when it should.
2022-01-07 12:26:26 +02:00
HoneyryderChuck
d3b36c5668 added support for HTTP/2 proxy by simplifying the overall http proxy implementation 2022-01-07 12:26:26 +02:00
HoneyryderChuck
1343c74e31 fixing overwriting connection #transition, which wasn't taking tcp connect on proxy errors 2022-01-07 12:26:26 +02:00
HoneyryderChuck
0e9823158a bumped version to 0.18.5 2022-01-02 23:31:43 +02:00
HoneyryderChuck
8dec7ed093 Merge branch 'ruby-3.1' into 'master'
adding ruby 3.1 to CI

See merge request honeyryderchuck/httpx!187
2022-01-02 20:55:03 +00:00
HoneyryderChuck
c7ee489c78 Merge branch 'issue-176' into 'master'
fix: HTTP/1.1 pipeline disable out of consumption loop

Closes #176

See merge request honeyryderchuck/httpx!185
2022-01-02 20:36:45 +00:00
HoneyryderChuck
0fcb55d502 fixed origin uri handling, to make it still quack like a URI::HTTP on uri 0.11 2022-01-02 22:32:54 +02:00
HoneyryderChuck
9596f5a5e1 fix: use passed host header as authority for HTTP/2
"host" header is considered an invalid HTTP/2 header, and I think that,
although we log it, the parser does not send it. However, this is
equivalent to a silent fail. We'll be then copying cURL's behaviour,
i.e. use the user-set "host" as ":authority", but we'll be logging this
behaviour, in case it changes in the future.

Fixes #177
2021-12-31 18:13:59 +02:00
HoneyryderChuck
be4bdb3cf5 fix: HTTP/1.1 pipeline disable out of consumption loop
pipeline disabling may happen on the `handle_error` phase outside of the
main consumption loop, so the `throw` call is out of context, and needs
to be guarded against. we're alreaady doing in the handler, so I'm just
quick-fixing it fow now.

Fixes #176
2021-12-31 17:54:44 +02:00
HoneyryderChuck
87bb4a4994 bumped to 0.18.4 2021-12-27 01:40:05 +02:00
HoneyryderChuck
d4bc21d65c alt-svc: yield alt origin as either http or https url, pass proto as an option 2021-12-27 01:14:33 +02:00
HoneyryderChuck
f56619efba fix: support webmock retries / response sequences
The previous implementation of the webmock plugin bypassed the
connection layer, which made it ignore key plugins like the retries
plugin. The whole plugin was redone so that it'd hook at the connection
level when piping requests.

A small difficulty was on how to handle the connection initialization
state when needing to unmock, as name resolving triggers before requests
are piped. A hack with a #once callback was implemented.

Fixes #170
2021-12-26 23:52:10 +02:00
HoneyryderChuck
3b882f59d6 Merge branch 'issue-171' into 'master'
fix: remove mime-types support for mime type file detection

Closes #171

See merge request honeyryderchuck/httpx!180
2021-12-24 11:42:39 +00:00
HoneyryderChuck
dea70478ea faraday: added support for #on_data 2021-12-22 16:01:48 +02:00
HoneyryderChuck
be5300ea4a fix: remove mime-types support for mime type file detection
mime-types uses filenames, which is a terrible and inaccurate strategy
to infer mime types (example: "a.mp4" can be "application/mp4" or
"audio/mp4" before it's "video/mp4").

Added support for `marcel` and `filemagic`, which both support magic
bytes detection strategy.

Fixes #171
2021-12-18 00:47:19 +00:00