1117 Commits

Author SHA1 Message Date
HoneyryderChuck
889c2f3f79 Merge branch 'issue-189' into 'master'
Support other auth schemes for proxies (digest, ntlm...)

Closes #189

See merge request honeyryderchuck/httpx!204
2022-05-16 22:15:29 +00:00
HoneyryderChuck
71bb6dc2ce Merge branch 'issue-179' into 'master'
Disable SNI when the URL host is an IP

Closes #179

See merge request honeyryderchuck/httpx!203
2022-05-16 22:15:21 +00:00
HoneyryderChuck
0d01f728aa introducing base_path option
This should complement the `:origin` option, in order to provide good
defaults to build REST SDKs around of.

Ex:

```ruby
HTTPX.with(origin: "https://api.this-product.com", base_path: "/v3.1")
```
2022-05-08 17:43:26 +01:00
HoneyryderChuck
c86f4be1a7 reworking auth APIs for a future 1.0 refactoring 2022-05-08 17:23:07 +01:00
HoneyryderChuck
be06032649 adding APIs for running other proxy auth schemes, and adapting internals to work with it 2022-05-07 18:20:07 +01:00
HoneyryderChuck
a316b31e7d fix: SNI is now disabled when the URL host is an IP 2022-05-07 18:17:47 +01:00
HoneyryderChuck
817a10a537 scoping http auth schemes out of its plugins, made them usable in proxy
In order to expose other auth schemes in proxy, the basic, digest and
ntlm modules were extracted from the plugins, these being left with the
request management. So now, an extra parameter, `:scheme`, can be
passed (it'll be "basic" for http and "socks5" for socks5 by default,
can also be "digest" or "ntlm", haven't tested those yet).
2022-05-07 13:57:10 +01:00
HoneyryderChuck
c23cc432e9 bumped version to 0.19.8 2022-05-06 17:24:12 +01:00
HoneyryderChuck
42bcfd3a93 adapting datadog plugin to datadog 1.0 release 2022-05-06 13:15:07 +01:00
HoneyryderChuck
7e54db8805 bumped version to 0.19.7 2022-04-08 09:39:30 +01:00
HoneyryderChuck
637d2f7600 fix: proxy credentials were not being used
a regression from the 0.19.x series was omitting the proxy credentials
when passed directly as proxy options (instead of being part of the URI).

Closes #188
2022-04-05 22:53:45 +01:00
HoneyryderChuck
27268ee228 bumped version to 0.19.6 2022-04-04 18:22:25 +01:00
HoneyryderChuck
1cf8c68ac6 fix: do not subclass session class to make it play along with default
class overrides

the faraday adapter was relying on subclassing the session to load
custom plugins. this doesn't play well with other integrations
monkeypatching the original session class, such as datadog or webmock,
which redefine it. from now on, we not only defer the creation of the
custom until necessary, we also use Session#plugin

Fixes #187
2022-04-04 12:54:33 +01:00
HoneyryderChuck
603fc0979a bumped version to 0.19.5 2022-03-30 20:29:44 +01:00
HoneyryderChuck
64f8ebcf51 exposing original hostname in errors when there's a dns error in a candidate name for resolution 2022-03-28 12:51:35 +01:00
HoneyryderChuck
0490175835 removing match overrides (irrelevant) 2022-03-25 06:35:15 +00:00
HoneyryderChuck
2d9d837543 fix: aligning mapping of requests to existing connections
previously, a connection could be created based on request options. The
main problem is that requests may have special headers, which would make
them assign its own connection due to the headers mismatch in headers to
the already open connection to the same origin. This, in certain
scenarios, coupled with the persistent plugin, cascades into multiple
connections to the same host which are never closed.

This fix ensures that connection initial options comes from the session.
This way, it'll never change (as connections exhaust). Alongside that,
matching headers was relaxed to only take into account headers which the
original connection knows, special request headers will then opt out
from this.
2022-03-25 06:35:15 +00:00
HoneyryderChuck
6ad59453ce handling the case where there might not be any connections running in the system resolver 2022-03-23 19:03:30 +00:00
HoneyryderChuck
30df921387 limit candidates resolution to the first resolv call, while also adapting the retries logic in the native resolver 2022-03-20 15:44:12 +00:00
HoneyryderChuck
61c4df243a https resolver: support resolv.conf search and ndots params 2022-03-20 02:29:58 +00:00
HoneyryderChuck
53ee7ae225 native resolver: support resolv.conf search and ndots params 2022-03-20 02:25:39 +00:00
HoneyryderChuck
35d9c15f44 bumped version to 0.19.4 2022-03-06 17:22:17 +00:00
HoneyryderChuck
c989a14435 native resolver fix: do not signal interests when there's nothing to do (was generating bursty IO) 2022-03-06 15:40:48 +00:00
HoneyryderChuck
b3ddad06e5 resolver: do not mutate early resolve addresses, as it may mutate cached results 2022-03-05 23:15:59 +00:00
HoneyryderChuck
d77a5cb50e fix: only go with the coalesce path if the connections actually coalesced 2022-03-05 23:14:33 +00:00
HoneyryderChuck
0e6e879eef removing ffi-based custom openssl for jruby 2022-03-03 12:46:29 +00:00
Thomas Cannon
f7bcc27385
Fix WebMock adapter to use request.query to build request signature
* Webmock allows users to stub a request using a URI with query
	parameters, as a shortcut instead of using `with...`
	* The Webmock adapter did not construct a URI that included the
		`request.query`, causing stubs that had the same host/path, but
		different queries, to return incorrect results
2022-02-23 11:08:59 -05:00
HoneyryderChuck
890320e0bd bumped version to 0.19.3 2022-02-21 16:27:31 +00:00
HoneyryderChuck
6dc4c9b2f0 bugfix: bust cache lookup if returned set from different ip family
This type of lookup was guarded in the first DNS query lookup, however
after recursive CNAME queries, this could trigger a case where an AAAA
query would fetch cached A records, which would be filtered out but
still delivered.

Closs #184
2022-02-20 22:28:10 +00:00
Pablo Crivella
f5a8e60d43 Allow retry_after to be a Float 2022-02-14 12:56:14 +00:00
HoneyryderChuck
b1a7e425ce bumped version to 0.19.2 2022-02-13 15:06:02 +00:00
HoneyryderChuck
84a4e2109c fix: skip resolution delay path for early resolve cases
when the early resolve path (using IP, /etc/hosts IP, IP from cache) is
followed, emit_addresses is called, and in a particular case (dual-stack
network but using an IPv4 address), the happy eyeballs resolution delay
path was activated when it shouldn't (it's meant to be used only for DNS
network requests), and resulted in @pool being called before it was ever
set.

This simple check ensures that it doesn't happen before it must.

Closes #182
2022-02-13 14:41:43 +00:00
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