1085 Commits

Author SHA1 Message Date
HoneyryderChuck
5d4ac62bf2 bumping version to 0.14.0 2021-05-22 16:19:52 +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
3eddfdb509 bugfix: do not blindly sum origins when merging connections
so that there are no repeated entries.

Fixes #125
2021-05-21 18:21:14 +01:00
HoneyryderChuck
ff5ed7be59 added support for TLS channel credentials 2021-05-20 00:59:14 +01:00
HoneyryderChuck
b09aef506e wrapping all responses from the grpc plugin in a GRPC::Call
calls are proxies which can access response metadata as it arrives. For
instance, it's possible to now get metadata (which are http headers)
before the response is fully streamed. #trailing_metadata will also be
empty until the response has been fully processed.

This builds on top of the stream plugin improvements foundation.
2021-05-20 00:11:26 +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
a1d09889ff adding grpc subfolder, extracting Message module, adding a Call abstraction 2021-05-10 12:38:41 +01:00
HoneyryderChuck
bbe5c2d114 added support for grpc deadline options 2021-05-07 16:55:48 +01:00
HoneyryderChuck
02dfb9073e allow connections to cleanup refused streams 2021-05-07 16:55:48 +01:00
HoneyryderChuck
232b94590a grpc: added client and server cancellation request support 2021-05-07 16:55:48 +01:00
HoneyryderChuck
949f073738 added test to prove support for requests cancelled from server 2021-05-06 10:38:20 +01:00
HoneyryderChuck
b73882210f bugfix: do not reset content-length for compressed body if the body is streamable (not only chunked) 2021-05-06 10:38:20 +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
fd31d9de0d allow for compression of grpc messages; testing using grpc 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
4d0750c950 stream: delegate to real response if available, only then generate a brand new one 2021-05-05 13:18:47 +01:00
HoneyryderChuck
5772f83149 added client and server stream tests and implementation
bidi calls also "just" work (tm)
2021-05-05 13:18:47 +01:00
HoneyryderChuck
d6a03f3e24 first grpc+proto unary test + implementation 2021-05-04 20:09:50 +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
dbdf7b95a2 added initial test and implementation of a quasi-unary interface 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
56aecf8067 options: on extra_options class extension, always pass the original options as arg 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
3cf47a4865 http2_settings -> wait_for_handshake option
(false by default) when true, requests will be immediately buffered
before HTTP/2 handshake is complete.
2021-04-12 16:38:12 +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
82dc700059 callbacks: use symbol comparison instead, even at the cost of an yoda cond 2021-04-12 00:26:53 +01:00
HoneyryderChuck
bc6bc903fc moved default options out of the initializer 2021-04-08 17:46:54 +01:00
HoneyryderChuck
bf0ec99794 removed the timeout class 2021-04-08 17:34:19 +01:00
HoneyryderChuck
383d624b71 changed all def_option from plugins to use the eval'ed string approach 2021-04-08 15:58:10 +01:00
HoneyryderChuck
c5b191d4e1 Options: allow to call def_option with a string
One can pass the body to be class_eval'ed, making the option not depend
on define_method.
2021-04-08 15:34:10 +01:00
HoneyryderChuck
261dc9af30 raise an HTTPX::Error when passed an unknown option
before, a random NoMethodError was being raised. now, an helpful message
and an HTTPX error people might be rescuing will be raised.
2021-04-07 10:05:50 +01:00
HoneyryderChuck
58824d1acd do not do check on pathname without checking for existence (breaks if pathname lib isn't required) 2021-04-06 20:23:45 +01:00
HoneyryderChuck
06fd76892c bumped to 0.13.2 2021-04-02 09:55:00 +01:00
HoneyryderChuck
53b894170d reinstated the legacy UDP#write for jruby, because there's no sendmsg_nonblock 2021-04-01 19:59:39 +01:00
HoneyryderChuck
6e4ce5a638 using sendmsg_nonblock instead of #send for udp writes 2021-04-01 19:06:28 +01:00
HoneyryderChuck
6f5dd472f0 native resolver: read/write only when necessary
windows udp sockets return WSAEINVAL if recvfrom_nonblock is called when
unbounded, ie. when not bound to an address in listener mode, nor before
actually sending data, which is our case.

This fix works the same way as HTTP connections, i.e. by avoiding
read/write operations when there's no need. This can also give us some
performance.

Fixes #36
2021-04-01 18:30:21 +01:00
HoneyryderChuck
011a70a598 do not try to upgrade an error response 2021-04-01 09:52:49 +01:00
HoneyryderChuck
8ec74402f1 bumped to 0.13.1 2021-03-27 19:15:53 +00:00
HoneyryderChuck
ff057861a7 rescue EALREADY for exception: false calls to connect_nonblock 2021-03-27 19:08:45 +00:00
HoneyryderChuck
fe6bbe0058 bumped to 0.13.0 2021-03-27 16:28:43 +00:00
HoneyryderChuck
1ef0371ef0 skip pipelining if the client isn't pipelining 2021-03-26 23:49:19 +00:00
HoneyryderChuck
3c2abce23a optimization: do not merge options wit itself (which was happening, producing the same data, but different identity) 2021-03-23 16:30:45 +00:00
HoneyryderChuck
61631ada18 removed Options.defined_options
using instance variables to get definition of an hash representation
instead.
2021-03-23 16:30:45 +00: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
23310e5ebf remove unreachable special callback
this was causing some unfortunate loops around the tcp connect, and
judging by the history, it's solving an issue related to the https
resolver, which has changed and stabilized significantly.
2021-03-09 19:28:00 +00:00
HoneyryderChuck
cad4079cb3 making sure that addresses map to proper addrinfo when in tcp mode 2021-03-09 19:27:14 +00:00
HoneyryderChuck
8a33a9f4db removing unneeded cond (it's already done in the initializer) 2021-03-08 17:04:36 +00:00
HoneyryderChuck
765fc540f4 fixing inspection of ios 2021-03-08 17:04:36 +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