Commit Graph

2247 Commits

Author SHA1 Message Date
Taiki Endo
9998f0fd0b refactor(lib): remove pin related unsafe code (#2220) 2020-06-08 16:02:14 -07:00
Taiki Endo
d5d09ed753 refactor(lib): Remove uses of pin_project::project attribute (#2219)
pin-project will deprecate the project attribute due to some unfixable
limitations.

Refs: https://github.com/taiki-e/pin-project/issues/225
2020-06-05 16:53:58 -07:00
Geoffry Song
2354a7eec3 feat(http2): configure HTTP/2 frame size in the high-level builders too (#2214)
Oops, I missed this in #2211.
2020-06-02 19:45:12 -07:00
Sean McArthur
b6fb18aee0 v0.13.6 2020-05-29 11:55:20 -07:00
Geoffry Song
b64464562a feat(http2): allow configuring the HTTP/2 frame size
The default of 16K is taken from h2.
2020-05-29 07:37:22 -07:00
Roland Kuhn
042c770603 feat(body): remove Sync bound for Body::wrap_stream
A stream wrapped into a Body previously needed to implement `Sync` so
that the Body type implements this autotrait as well (which is needed
due to limitations in async/await). Since a stream only offers one
method that is called with an exclusive reference, this type is
statically proven to be Sync already. In theory it should be fine to add
an `unsafe impl Sync`, but this commit instead adds a SyncWrapper to
enlist the compiler’s help in proving that this is (and remains) correct.

This makes it easier to construct response bodies for client code.
2020-05-19 12:57:09 -07:00
Joshua Nelson
d5b0ee5672 refactor(client): switch from net2 to socket2 (#2206)
net2 was recently deprecated; socket2 is the recommended alternative

Closes #2205
2020-05-18 17:19:38 -07:00
Sean McArthur
6fbb6db876 docs(body): fix resolution error on Body::default 2020-05-18 16:43:31 -07:00
Sean McArthur
ccd7ebdbb1 chore(ci): remove unused .travis directory 2020-05-15 22:07:16 +00:00
Dirkjan Ochtman
aac0e2dd57 refactor(body): use HttpBody with extra bounds instead of Payload trait 2020-05-14 13:26:39 -07:00
Nikolai Kuklin
203621e3be feat(example): read file by chunks in send_file example (#2193) 2020-04-24 13:02:58 -07:00
Bastien Orivel
e08a271eb9 chore(dependencies): Force tokio to be at least 0.2.5 (#2186)
Without this, you can end up with tokio 0.2.4 and hyper 0.13.5 in your
project, leading to a compile error like this:

```
error[E0599]: no method named `try_recv` found for struct `tokio::sync::mpsc::unbounded::UnboundedReceiver<client::dispatch::Envelope<T, U>>` in the current scope
   --> src/client/dispatch.rs:161:26
    |
161 |         match self.inner.try_recv() {
    |                          ^^^^^^^^ method not found in `tokio::sync::mpsc::unbounded::UnboundedReceiver<client::dispatch::Envelope<T, U>>`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0599`.
error: could not compile `hyper`.
```
2020-04-18 08:18:28 -07:00
Sean McArthur
ffb759701c v0.13.5 2020-04-17 12:29:50 -07:00
Sean McArthur
aafeeb7638 refactor(http2): change rtt weighted moving average beta to 1/8 2020-04-16 17:00:20 -07:00
Dillon Amburgey
5f6ce3c733 docs(lib): fix misspelling 2020-03-31 22:01:29 -07:00
Sean McArthur
f329ae0ff9 refactor(benches): add adaptive_window http2 benchmark 2020-03-30 16:28:58 -07:00
Sean McArthur
39a3bc0ea5 refactor(benches): change end_to_end response body default to empty 2020-03-30 16:13:46 -07:00
Sean McArthur
97ed0478a8 refactor(client): replace futures oneshot with tokio in dispatcher 2020-03-25 14:50:51 -07:00
Sean McArthur
e6a6ddef7c refactor(client): replace futures mpsc for tokio mpsc in dispatcher 2020-03-25 14:50:51 -07:00
Sean McArthur
5b3724eeec chore(ci): re-enable minimum rust version (1.39) 2020-03-25 11:33:21 -07:00
Sean McArthur
fce3ddce46 fix(server): fix panic in Connection::graceful_shutdown 2020-03-25 10:28:46 -07:00
Sean McArthur
597cef225e test(body): fix Body size of tests on 32-bit architecture
Closes #2158
2020-03-24 11:56:26 -07:00
Sean McArthur
22fcd66241 v0.13.4 2020-03-20 16:13:44 -07:00
Sean McArthur
9a8413d910 feat(http2): add HTTP2 keep-alive support for client and server
This adds HTTP2 keep-alive support to client and server connections
based losely on GRPC keep-alive. When enabled, after no data has been
received for some configured interval, an HTTP2 PING frame is sent. If
the PING is not acknowledged with a configured timeout, the connection
is closed.

Clients have an additional option to enable keep-alive while the
connection is otherwise idle. When disabled, keep-alive PINGs are only
used while there are open request/response streams. If enabled, PINGs
are sent even when there are no active streams.

For now, since these features use `tokio::time::Delay`, the `runtime`
cargo feature is required to use them.
2020-03-20 14:20:45 -07:00
Sean McArthur
d838d54fdf fix(http1): try to drain connection buffer if user drops Body 2020-03-10 12:57:36 -07:00
Sean McArthur
5b046a1f8f v0.13.3 2020-03-03 15:34:49 -08:00
Sean McArthur
6a1bd055fc refactor(http2): store bdp sampler in Body H2 variant 2020-03-03 14:48:42 -08:00
Sean McArthur
a82fd6c94a feat(client): rename client::Builder pool options (#2142)
- Renamed `keep_alive_timeout` to `pool_idle_timeout`.
- Renamed `max_idle_per_host` to `pool_max_idle_per_host`.
- Deprecated `keep_alive(bool)` due to confusing name. To disable the
  connection pool, call `pool_max_idle_per_host(0)`.
2020-02-27 14:25:06 -08:00
Sean McArthur
48102d6122 feat(http2): add adaptive window size support using BDP (#2138)
This adds support for calculating the Bandwidth-delay product when using
HTTP2. When a DATA frame is received, a PING is sent to the remote.
While the PING acknoledgement is outstanding, the amount of bytes of all
received DATA frames is accumulated. Once we receive the PING
acknowledgement, we calculate the BDP based on the number of received
bytes and the round-trip-time of the PING. If we are near the current
maximum window size, the size is doubled.

It's disabled by default until tested more extensively.
2020-02-25 16:00:50 -08:00
Sean McArthur
22dc6fe4c6 doc(lib): hide error module documentation 2020-02-21 11:49:38 -08:00
Sean McArthur
6b47c69f4a test(http1): add benchmarks for fixed and chunked decoding 2020-02-19 13:43:26 -08:00
Sean McArthur
14fc2d00f1 style(http2): format http2 code 2020-02-19 12:29:59 -08:00
Sean McArthur
cc6b396e65 refactor(h2): change error message when poll capacity is canceled 2020-02-19 11:07:05 -08:00
daxpedda
24d53d3f66 feat(server): add poll_peek to AddrStream (#2127) 2020-02-17 11:31:36 -08:00
Sean McArthur
dd02254ae8 style(lib): apply latest rustfmt 2020-02-06 11:41:25 -08:00
Sean McArthur
141207769f v0.13.2 2020-01-29 12:41:58 -08:00
Sean McArthur
6cf6245741 refactor(client): touch up connect log formats 2020-01-29 12:29:46 -08:00
Sean McArthur
2983395d63 chore(lib): update pretty_env_logger to v0.4 (#2123) 2020-01-29 12:08:43 -08:00
Sean McArthur
dc88204716 fix(body): return exactly 0 SizeHint for empty body (#2122) 2020-01-29 11:55:07 -08:00
Sean McArthur
9d1271384b docs(examples): rename proxy example to gateway 2020-01-29 11:10:48 -08:00
Sean McArthur
5c6536317c docs(examples): improve README for examples directory 2020-01-29 11:09:21 -08:00
Kelly Thomas Kline
086fa359ff docs(readme): Add link to warp (#2081) 2020-01-29 10:26:59 -08:00
Linus Färnstrand
de7418da2f style(lib): use just std instead of ::std in paths (#2101) 2020-01-29 10:25:57 -08:00
Sean McArthur
c4bb4db5c2 fix(http1): only send 100 Continue if request body is polled
Before, if a client request included an `Expect: 100-continue` header,
the `100 Continue` response was sent immediately. However, this is
problematic if the service is going to reply with some 4xx status code
and reject the body.

This change delays the automatic sending of the `100 Continue` status
until the service has call `poll_data` on the request body once.
2020-01-28 17:32:58 -08:00
Sean McArthur
a354580e3f perf(body): reduce memory size of Body by a u64 (#2118)
Replaces the `Option<u64>` content-length with a `DecodedLength`, which
stores its unknown-ness as `u64::MAX`.
2020-01-27 13:09:40 -08:00
Sean McArthur
1881db6391 fix(http1): remove panic for HTTP upgrades that have been ignored (#2115)
Closes #2114
2020-01-23 16:41:40 -08:00
Sean McArthur
ba2a144f8b fix(client): strip path from Uri before calling Connector (#2109) 2020-01-13 11:45:28 -08:00
Markus Westerlind
a5720fab4c feat(service): Implement Clone/Copy on ServiceFn and MakeServiceFn (#2104) 2020-01-08 12:44:07 -08:00
danieleades
0eaf304644 style(lib): address most clippy lints 2020-01-03 09:40:32 -08:00
danieleades
0f13719873 refactor(error): remove deprecated 'Error::description' method (#2092) 2019-12-30 09:55:08 -08:00