1371 Commits

Author SHA1 Message Date
HoneyryderChuck
0fb343056d introducing :addresses option
(This deprecates the :transport_options option)

This should be given an array of peer addresses to connect to. It can be
used when the destination IPs are known and you want to avoid resolving
them, and when the destination is a unix socket (and the destination is
a FS path)
2021-03-08 12:46:20 +00:00
HoneyryderChuck
108837e25e bugfix: do not resolve connection which are already resolved
connections which either already contain addresses, or were given an
open IO object, should be marked as resolved, and should not go through
the resolver.
2021-03-08 12:42:32 +00:00
HoneyryderChuck
e8ac876443 setting the upgrade handlers per session. 2021-03-07 16:18:44 +00:00
HoneyryderChuck
d501840669 registering the supported encodings of the compression plugin per
session

In order not to leak these into other sessions, one keeps a registry
around as a session option. This will cascade into the request and
response encoding routines.
2021-03-05 19:04:09 +00:00
HoneyryderChuck
12d4885136 response body now holds the full options from the request 2021-03-05 19:04:09 +00:00
HoneyryderChuck
3fd4cd98cf Merge branch 'issue-110' into 'master'
upgrade plugin (and refactor of the h2c plugin, + h2 plugin, + websocket test)

Closes #110

See merge request honeyryderchuck/httpx!124
2021-03-05 17:25:36 +00:00
HoneyryderChuck
7fca78ad23 added custom upgrade plugin as example (for websockets) 2021-03-05 12:23:18 +00:00
HoneyryderChuck
a03e93e531 allow for oportunistic upgrades, such as the apache Upgrade: h2
this is achieved by a rework of the upgrade plugin, and the addition of
an h2 upgrade plugin. The idea is the following: if a response carries
an Upgrade header, and there's a handler for it, we should go for it.
The difference is:

* when the response is 101, this means that the negotiation must take
  place before the actual response comes in;
* when the response is 200, upgrading means reconnecting to the channel,
  and assume the new protocol for subsequent requests only.
2021-03-05 12:23:17 +00:00
HoneyryderChuck
72a397b841 added (and fixing bug for) test of subsequent request on upgraded
connection

After the connection has been upgraded and session is kept open,
subsequent requests were still trying to upgrade it. This fixes it by
marking the connection as upgraded, and falling back to normal
behaviour when it is.
2021-03-05 12:23:07 +00:00
HoneyryderChuck
d02b485c9e added blog-post about sigv4 2021-02-28 03:06:03 +00:00
HoneyryderChuck
a77091f9e7 refactor the h2c plugin on top of the upgrade plugin
By setting the h2c protocol handler, the rest became much simpler.

Formatting the upgrade request is a matter for the sub-plugin.
Therefore, the specific h2c request upgrade headers are built-in there.
2021-02-28 03:06:03 +00:00
HoneyryderChuck
e231238dc4 added the upgrade plugin, where subsequent upgrade protocols can build on 2021-02-28 02:50:44 +00:00
HoneyryderChuck
c2a6eb623b bumping version to 0.12.0 v0.12.0 2021-02-21 17:10:24 +00:00
HoneyryderChuck
5a3ac5078e added truffleruby mention 2021-02-21 16:20:07 +00:00
HoneyryderChuck
2be907d1ed Merge branch 'coverage-boost' into 'master'
Coverage boost

See merge request honeyryderchuck/httpx!123
2021-02-21 16:19:16 +00:00
HoneyryderChuck
aa64af9a1a removing init vars from zlib-deflate, might fix truffleruby 2021-02-21 16:09:45 +00:00
HoneyryderChuck
f3999daafc more simplecov ignores 2021-02-21 16:09:45 +00:00
HoneyryderChuck
ee505a92e5 testing altsvc lookups directly 2021-02-21 16:09:45 +00:00
HoneyryderChuck
48961d6c64 do not select on an http/2 connection with no ongoing comms
It was observed that, during a request done via a DoH resolve, the
resolver connection is left in the selector, despite already having
resolved the name, until the whole transfer is done. This is
inefficient, as we're not expected to use it again.

Fixed by improvinng the interest calculation of an HTTP/2 connection; if
the connection doesn't have anything to write. and there aren't  any
inflight streams nor pings, connection won't be listened on.
2021-02-21 16:09:45 +00:00
HoneyryderChuck
28852e19fa fixing double registry for DoH resolver
Some debugging surfaced that the resolving step of doh contains 2
registered connections in the selector, instead of just one. That's
because both the resolver and its inherent connection are registered.

Fixed it by marking the resolver as closed, in the same way we do for
the system resolver, which also nnever gets registered in the selector.
2021-02-19 17:13:19 +00:00
HoneyryderChuck
18625dbc11 registry: remove conversion (internal API, and not used anywhere) 2021-02-19 17:13:19 +00:00
HoneyryderChuck
3ed3dcaa43 ignore http/form-data warning from the coverage 2021-02-19 17:13:19 +00:00
HoneyryderChuck
a050b5a403 selector: jump out of the loop if there's nothing to wait on 2021-02-19 17:13:19 +00:00
HoneyryderChuck
825dcf867b resolver test: status might be an exception message 2021-02-19 17:13:19 +00:00
HoneyryderChuck
75c9f08964 added test for trailer headers (http/1 only) 2021-02-19 17:13:19 +00:00
HoneyryderChuck
c7251d9a17 remove internal telemetry from coverage 2021-02-19 17:13:19 +00:00
HoneyryderChuck
cedd14df09 compacting method_missing defs 2021-02-19 17:13:19 +00:00
HoneyryderChuck
edfd92ea60 added test for to_s rep of error response (i.e. must contain the canonical message class def) 2021-02-19 16:42:39 +00:00
HoneyryderChuck
b6c94f1702 added test for unsupported charset in response 2021-02-18 10:43:48 +00:00
HoneyryderChuck
7f103447ac Merge branch 'issue-111' into 'master'
byteslices

Closes #111

See merge request honeyryderchuck/httpx!122
2021-02-17 17:56:11 +00:00
HoneyryderChuck
39aab9dd09 more usage of byteslice in the http1 parser (in header parsing) 2021-02-17 01:23:49 +00:00
HoneyryderChuck
5c4cf4dd9e regression test for issue fixed in v0.11.2
added a test for parsing an RFC-2616-compliant expires date in the
cookie, which fails without the fix.
2021-02-17 01:23:16 +00:00
HoneyryderChuck
a2895d456f regression test for bug fixed in 0.11.3
created a test server which removes the content-length. Taken extra
condition into account, that the close might manifest itself while
selecting on the socket; at that point we're out of the consumption
loop, so better not to deal with throwing :called
2021-02-17 00:55:05 +00:00
HoneyryderChuck
4bcaf1e121 Merge branch 'issue-115' into 'master'
do not leave the read loop after the epiped event, unless we're out of...

Closes #115

See merge request honeyryderchuck/httpx!121
2021-02-16 21:46:49 +00:00
HoneyryderChuck
952ae7c1ef do not leave the read loop after the epiped event, unless we're out of requests to process or can't read from socket 2021-02-16 21:38:09 +00:00
HoneyryderChuck
3b2d822af9 Merge branch 'issue-90' into 'master'
syscall improvements

Closes #90

See merge request honeyryderchuck/httpx!120
2021-02-16 20:26:32 +00:00
HoneyryderChuck
d4fe89094e fixing TCP connection inprogress on SSL connection bug
The Errno::INPROGRESS error signals that the TCP handshake has been
signaled to the peer already, by which locally we just have wait for it
to be writable.

For simple plaintext requests, this was working correctly, because the
interest was always writable no matter what. However, when wrapped in
the SSL conn, and with the OS tcp stack under more stress, the interest
could be switched to readable, and by reuse, never reset; if, by
subsequent reconnection, EINPROGRESS would be emitted, the socket would
wait for readable instead, resulting in a loop and subsequent
connectionnn timeout.
2021-02-16 18:27:05 +00:00
HoneyryderChuck
d3cc6d2d96 making sure that every response is returned
although a connection might correctly emit an error response, the
returned responses are still defined by the fetch_response loop in the
session. When the pool is actually empty, this had the side-effect of
leaving error responses behind and exiting with just the first one.

This fixes it popping all available responses in such cases.
2021-02-16 18:27:05 +00:00
HoneyryderChuck
19dc528030 fixed broken pipe issue on quick error response from server
in some cases where the client is sending a request with a lot of bytes
(i.e. file uploads), and the server can't consume it (because
authorization, or wrong endpoint), the server stops processing the
request altogether and sends an error response immediately, in which
case the client should pivot and read the error response. Not doing this
was causing the Errno::EPIPE error. The mitigation is therefore to
rescue the error, and mark the consumption loop to read the response
immediately.
2021-02-16 18:27:05 +00:00
HoneyryderChuck
7082f63e4e more explicit error message in multipart test 2021-02-16 18:27:05 +00:00
HoneyryderChuck
4bab923f25 experimental optimizations in the connection call loop.
skip entering the read/write hot loops when the connection interests
specifically say so. this led to a overhaul of how interests are
calculated.
2021-02-15 17:20:41 +00:00
HoneyryderChuck
ad88aa27cf added more level 3 logging using a custom telemetry plugin, which is internal use only
this will therefore not be documented.
2021-02-15 17:20:41 +00:00
HoneyryderChuck
bfe77fe92c fixing initializationn of connect timeout, which needs the failed timeout value 2021-02-15 17:20:41 +00:00
HoneyryderChuck
981824bf47 fixing how to load plugins on boot, such as the http_proxy when the system proxy is set 2021-02-15 17:20:41 +00:00
HoneyryderChuck
cb07abc94e unused condition in pool 2021-02-15 17:20:41 +00:00
HoneyryderChuck
8feecf693f Merge branch 'issue-114' into 'master'
fixing http/1.1 bug when response doesn't have a content-length

Closes #114

See merge request honeyryderchuck/httpx!119
2021-02-15 16:48:11 +00:00
HoneyryderChuck
fa72b25a57 bumped to 0.11.3 v0.11.3 2021-02-15 15:05:22 +00:00
HoneyryderChuck
17aeb10e0b fixing http/1.1 bug when response doesn't have a content-length
if a response does not advertise its body length, then the server closes
    the connection when there's no more data to read. Therefore, the
    HTTP/1.1 parser should interpret these conditions accordingly, and
    emit the response.

Closes #114
2021-02-15 15:05:01 +00:00
HoneyryderChuck
d9ffa846a6 Merge branch 'issue-113' 2021-02-12 12:52:20 +00:00
HoneyryderChuck
396f02c904 show how much mem gitlab is letting the job use v0.11.2 2021-02-12 11:15:41 +00:00