60 Commits

Author SHA1 Message Date
HoneyryderChuck
4df2363cc5 providing strategy for punycode translation, using idnx when possible, falling back otherwise 2021-06-11 18:27:40 +01:00
HoneyryderChuck
5cfb494d50 allow parsers to define a connection timeout, and channge it via callback 2021-05-30 00:57:54 +01:00
HoneyryderChuck
b569cc9984 adding the settings timeout as an option, as well as a specific error 2021-05-30 00:53:37 +01:00
HoneyryderChuck
fb3b795f29 adding missing grpc sigs (+ other missing stuff in plugin calls) 2021-05-28 12:15:09 +01:00
HoneyryderChuck
5b9793752c fixing other plugin signatures 2021-05-27 19:11:15 +01:00
HoneyryderChuck
df489676ac adding ntlm auth plugin 2021-05-27 19:11:15 +01:00
HoneyryderChuck
dda1315db4 adding tests to enure that field order is respected, even when repeated, when performing form/multipart requests (Closes #126) 2021-05-27 19:11:15 +01:00
HoneyryderChuck
c61007ba0f do not forget the filename in those multipart spoofs 2021-05-27 17:53:45 +01:00
HoneyryderChuck
8e1e6b3c6a set_protocol_headers now returns extra fields, that can be yielded in the handler, instead of merged into the request
this implicit mutation of the request was causing issue in insecure
redirects, which kept the same HTTP/2 specific headers in HTTP/1
payloads
2021-05-26 18:13:53 +01:00
HoneyryderChuck
e5a8e76d62 allow Headers#each to be passed extra headers to yield 2021-05-26 18:13:53 +01:00
HoneyryderChuck
2c3280b6d0 Merge branch 'issue-119' into 'master'
new option: origin

See merge request honeyryderchuck/httpx!131
2021-05-22 14:23:05 +00:00
HoneyryderChuck
44106325d5 bugfix: do not set new session callbacks on connections which already have them
a subtle bug surfaced when trying multiple individual requests on the
same persistent session, where the connection was being removed from the
watchable connections after each request, but kept in the pool; on the
next request, it would set the same session callbacks; this would go on
and on until connections would get exhausted, after which all of these
callbacks would have to be called.

fixed by having a new callbacks interface, #only, which discards
existing callbacks by type, thereby ensuring there's only one of the
kind.
2021-05-21 18:26:54 +01:00
HoneyryderChuck
441716a5ac fixing double-response for streams
there was a long-standing buggy workaround, whereas in stream-mode, when
there was no response yet to query from, a synchronous request would be
fired. This would break when under event streams, so we had to document
this as "make sure that...".

This fixes it by implementing a general session API convention, which
separates the step of sending the requests, from waiting for its
receival. And, given that the request knows when the response is
available, we can actually "tick until response".

This might be used in the future to refactor the way we handle the
responses, which buffer the full payload by default, instead of reading
from the connection at will.
2021-05-20 00:11:26 +01:00
HoneyryderChuck
232b94590a grpc: added client and server cancellation request support 2021-05-07 16:55:48 +01:00
HoneyryderChuck
7a60346bf7 Added trailer header support for writing requests
Request can also add their own trailer headers, either explicitly via
Request#trailers , or via request lifecycle callbacks
2021-05-06 10:38:20 +01:00
HoneyryderChuck
837c7ddf17 allowing .deflate to be called synchronously 2021-05-06 10:38:20 +01:00
HoneyryderChuck
1cf6e5aac7 new option: origin
by setting the origin, one can pass relative paths to httpx, which will
be appended when building the request.
2021-05-04 20:09:50 +01:00
HoneyryderChuck
3e7dfe3e7f stream: moved StreamResponse to the HTTPX namespace 2021-05-04 20:09:50 +01:00
HoneyryderChuck
e436c4fa04 options: always load plugins in the .configure callback 2021-05-04 20:09:50 +01:00
HoneyryderChuck
351276dcb5 added support for multiple header frame received callback calls, by merging them (trailer header case) 2021-04-12 16:38:11 +01:00
HoneyryderChuck
bf0ec99794 removed the timeout class 2021-04-08 17:34:19 +01:00
HoneyryderChuck
9363d09af8 removed with_ methods from option (not of real world use)
removed with_ options, which are unsupported, undocumented and irrelevant (contrary to the similar with session methods)
2021-03-23 16:30:45 +00:00
HoneyryderChuck
fbf9b12a0b bugfix: ensuring :io option as hash works
while adding tests, found out that io as hash of authority => io wasn't
working due to missing uri extensions. Made sure the same works for unix
sockets.
2021-03-08 17:04:36 +00:00
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
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
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
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
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
75c9f08964 added test for trailer headers (http/1 only) 2021-02-19 17:13:19 +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
ff87177a4a added module signatures 2021-02-06 16:24:35 +00:00
HoneyryderChuck
db036aaefa protocol: passing protocol specific headers as a request callback 2021-02-02 18:33:24 +00:00
HoneyryderChuck
7fa283097d added signatures to new modules 2021-01-13 12:27:13 +00:00
HoneyryderChuck
c2a85311d4 fixed signature of expects\? 2021-01-09 17:28:02 +00:00
HoneyryderChuck
dbc12a91b5 importing tests from webmock 2021-01-01 16:56:36 +00:00
HoneyryderChuck
d6465ce433 by passing arity to curry calls, methods can be type-checked now 2020-12-19 00:26:05 +00:00
HoneyryderChuck
65f5e86f3f allowing nested params also when posting multipart requests 2020-12-10 13:46:57 +00:00
HoneyryderChuck
0bb18ad500 added urlformencoder which encodes form data the way rack is used to, when nested 2020-12-10 01:07:18 +00:00
HoneyryderChuck
7ba354bcac typing the resolvers 2020-12-09 14:27:27 +00:00
HoneyryderChuck
7bd9f9a33f typing the connection pool 2020-12-08 16:47:39 +00:00
HoneyryderChuck
392dadcb78 typing the connection parsers 2020-12-07 17:46:45 +00:00
HoneyryderChuck
beb0a82baa typing selector and connection 2020-12-07 16:30:39 +00:00
HoneyryderChuck
a675fde7dd enable singleton usage in rbs sigs 2020-12-02 01:30:38 +00:00
HoneyryderChuck
201591e9fe added test for the socks5 non-happy path 2020-12-02 01:30:38 +00:00
HoneyryderChuck
37999cc39e improved testing of body transcoder 2020-12-02 01:30:38 +00:00
HoneyryderChuck
7a5353ea90 fixed signing of the stream session request 2020-11-25 11:54:51 +00:00
HoneyryderChuck
cb3e57e10d fixing log_exception signature 2020-11-24 16:38:46 +00:00
HoneyryderChuck
1e21c33da0 fixinng the signatures for the last rbs upstream 2020-11-24 00:42:54 +00:00