1147 Commits

Author SHA1 Message Date
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
HoneyryderChuck
17b3b6c1d1 bumped version to 0.18.3 2021-12-14 20:19:20 +00:00
HoneyryderChuck
c8d32b7363 fix: request bodies eager-loaded from enumerables yield duped partial
strings

An error was observed while looking at webmock integration, where
requests formed via the multipart plugin where returning an empty string
as body. The issue was caused by an optimization on multipart encoder,
which reuses the same buffer when reading chunks. Unfortunately, these
cannot be yielded the same way via IO.copy_stream, as the same (cleared)
buffer will be used to generate the eager-loaded body chunks.
2021-12-14 19:12:58 +00:00
HoneyryderChuck
facffe7644 bumped version to 0.18.2 2021-12-09 17:53:41 +00:00
HoneyryderChuck
edc2c4e6c4 do not loop forever if there are no connections to listen nor any timer
to wait for.

Timeout calculation may trigger errors which lead to connection
unregistering, such as tital timeout errors. In such a case, we can end
up in a state where #select gets called with no timeout and no
selectable connections.

https://github.com/HoneyryderChuck/httpx/issues/3
2021-12-09 15:02:32 +00:00
HoneyryderChuck
8e77f0464a bumping version to 0.18.1 2021-11-23 10:32:12 +00:00
HoneyryderChuck
ab70f6a586 total timeout call should bubble up exception, not timeout value 2021-11-19 23:03:08 +00:00
HoneyryderChuck
f3cff86775 cleaning up state within an http2 connection receiving a goaway, to properly mark it to be close; this will prevent unfinished pending requests to fall in the same connection, resulting in an unrecoverable internal state error 2021-11-19 16:24:50 +00:00
HoneyryderChuck
0f80baf351 retries plugin: make errorless http2 connnection goaway a retryable error 2021-11-18 18:12:32 +00:00
HoneyryderChuck
5a61586fd5 do not ignore goaway with no errors sent by the server, let the connection go down
raise a specific error for this, which will make it easier to rescue
from.
2021-11-18 18:07:12 +00:00
HoneyryderChuck
c7d73d09b8 coalescing: do not try to use a self-signed certificate for coalescing verification purposes 2021-11-17 21:35:31 +00:00
HoneyryderChuck
72924e420b fixing HTTP/1 logging on pipelining, where the buffered requests would appear in the second request log 2021-11-14 02:56:32 +00:00
HoneyryderChuck
b18b715818 some small rbs improvemments 2021-11-13 11:09:29 +00:00
HoneyryderChuck
8a8e0998df bumping version to 0.18.0 2021-10-02 23:53:07 +01:00
HoneyryderChuck
b2a5371fe2 fix missing var 2021-10-02 00:27:37 +01:00
HoneyryderChuck
a3ee98f410 implementation of the response cache plugin 2021-10-01 23:53:21 +01:00
HoneyryderChuck
a60fde07d6 added plugin tests, and the plugin body 2021-10-01 23:38:38 +01:00
HoneyryderChuck
bdcd4b31b5 aws_sdk plugin: removing S3 plugin APIs, replacing it with barebones aws-sdk-core components 2021-10-01 23:20:19 +01:00
HoneyryderChuck
8f5c45225b removing aws-sdk-s3 constraint in sigv4 plugin (does not require anything aws-sdk related) 2021-10-01 23:20:19 +01:00
HoneyryderChuck
1e4177a079 allow connections to be closed before they even started, if some error coming from the parser requires it (can happen if user input is evaluated in httpx time and fails) 2021-09-27 16:18:02 +01:00
HoneyryderChuck
eb5bdc1fe6 telemetry: fixed visibility of #close; more log data 2021-09-27 16:18:02 +01:00
HoneyryderChuck
207ecb2da0 bugfix: making https resolver subscribe to the right pool
(such as when it's overwritten, such as in the case of SessionWithPool Module)
2021-09-27 16:18:02 +01:00
HoneyryderChuck
efddd72caa removing persistent connections from the selector whe inactive
keeping them around was resulting in some busy loops on timer events
(i.e. retry after), making them unreliable, innacurate  and CPU
draining. they're now kept out whenever they're inactive.
2021-09-27 16:18:02 +01:00
HoneyryderChuck
52948e0f83 bugfix: prevent stream close callback from being called 2 times
an issue was observed when stream was closed from our side, that the
the request in-flight count on the connection. This was fixed by not
reacting to :stream_closed events if request has been previously deleted.
2021-09-23 12:12:48 +01:00
HoneyryderChuck
81a41d889c bugfix: remove connections from selector which have been unregistered
during interest calculation

A quirk was found whereby a connection which failed while connecting
(such as the badssl test) was properly unregistered from the pool, was
however kept in the selectables selector pool, because if this operation
happening during the interest calculation pool, and the var substitution
being performed right afterwards, leaving the pool and selector out of
sync and causing all sorts of miscalculations around timers later on.
2021-09-22 12:53:33 +01:00
HoneyryderChuck
6425e5d8ee moved calculation of pool timeout to #next_timeout fully 2021-09-22 12:48:40 +01:00
HoneyryderChuck
c1881dc65b preparing for URI::HTTP#origin in mainline 2021-09-22 12:48:40 +01:00
HoneyryderChuck
bd1946999f improving retry logs 2021-09-22 12:48:40 +01:00
HoneyryderChuck
13e865e488 hiding monotonic time funcs under the utils API 2021-09-20 16:16:20 +01:00
HoneyryderChuck
27d81f3090 introduce custom timer to replace Timers::Group
The HTTPX::Timers class mimicks the same top-level API as its
predecessors, but simplifies its implementation. Adding a timer will
resort all timers, while lookups are roughly the same complexity. The
key difference is that callbacks are now aggregated by interval, i.e.
different requests setting the same timeout, will reuse the same timer.
This is a more simple design than Timers::Group, which stores timers in
a binary search tree; the latter will perform well in any environment,
whereas the first one is more tailored for the use-case of httpx, where
most of the times no timers will be set, and when they do, the same
timer will be reused for all requests because they usually have the same
set of options (and therefore timeouts).
2021-09-20 13:19:55 +01:00
HoneyryderChuck
9d861c3c2f total_timeout does not rely on Timers#after
Instead, timeout accounting is done using total_timeout math. It
supersedes all other timeouts in the connection, and will start from th
moment the connection is established.
2021-09-20 13:19:55 +01:00
HoneyryderChuck
b0e057c15d reworked the keep-alive timer logic to not rely on Timers#after 2021-09-20 13:19:55 +01:00
HoneyryderChuck
bdacaf1d41 Merge branch 'issue-153' into 'master'
Improving API compatibility and error checking in responses

Closes #156 and #153

See merge request honeyryderchuck/httpx!170
2021-09-20 12:19:32 +00:00
HoneyryderChuck
a31a315e08 deprecating ErrorResponse#status 2021-09-20 13:02:20 +01:00
HoneyryderChuck
f768cf7a0e Improving API compatibility and error checking in responses
* `Response#error`, which, coupled with `ErrorResponse#error`, allows
  for `if response.error` kind of conditional;
* `Response#raise_for_status` now returns the response when no error is
  raise (for method chaining);

Closes #153
2021-09-20 13:02:20 +01:00
HoneyryderChuck
cdce779e44 ErrorResponse#to_s should not contain tty color codes (Closes #152) 2021-09-20 13:01:59 +01:00
HoneyryderChuck
6e6c7848cc making jitter a retry plugin option 2021-09-20 12:37:48 +01:00
HoneyryderChuck
3b85678834 Merge branch 'issue-150' into 'master'
retries: apply some jitter on the retry after value

Closes #150

See merge request honeyryderchuck/httpx!167
2021-09-12 16:37:52 +00:00
HoneyryderChuck
579ee4d0cc retries: apply some jitter on the retry after value 2021-09-12 16:10:50 +01:00