Commit Graph

2479 Commits

Author SHA1 Message Date
Eliza Weisman
71f3402421 fix(http1): ending close-delimited body should close (#2322)
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
2020-11-06 15:38:01 -08:00
Sean McArthur
1b9af22fa0 Tokio 0.3 Upgrade (#2319)
Co-authored-by: Urhengulas <johann.hemmann@code.berlin>
Co-authored-by: Eliza Weisman <eliza@buoyant.io>
2020-11-05 17:17:21 -08:00
Sean McArthur
cc7d3058e8 chore(lib): start 0.14.x development 2020-11-02 16:17:15 -08:00
Sean McArthur
42560c7c40 v0.13.9 2020-11-02 15:20:53 -08:00
Pedro Calado
2a938d96ae fix(server): reschedule keep alive interval timer once a pong is received
`KeepAliveState` did not transition from `PingSent` to `Scheduled` after
a pong was received. This prevented more than one ping to be sent by the
server. This fix checks if `ping_sent_at` has already been cleared by
`Ponger::poll` when `KeepAliveState::PingSent` state is active.

Fixes #2310
2020-10-29 09:02:26 -07:00
Pedro Calado
f288641792 test(server): test server keep alive by counting number of pings
Add `http2_keep_alive_count_server_pings` which tests if 3 pings are
received under 5 seconds with keep alive interval set to 1 second.
2020-10-29 09:02:26 -07:00
Ivan Nikulin
fb19f3a869 feat(client): add HttpConnector::set_local_addresses to set both IPv6 and IPv4 local addrs (#2172)
Currently HttpConnector::set_local_address method accepts a single
argument. Server might not support IPv6 or IPv4. Therefore, the only
solution at the moment is to manually perform DNS resolution and pick
appropriate local address family. This is inefficient, as leads to
2 DNS lookups per request. This commit allows specifying both IPv4
and IPv6, so connector can decide which one to use based on DNS
resolution results.
2020-10-13 16:02:16 -07:00
Taiki Endo
02732bef0c chore(dependencies): update pin-project to 1.0 (#2298) 2020-10-13 11:14:47 -07:00
Steven Fackler
2dc9768d2d feat(client): Add accessors to Connected fields (#2290) 2020-09-29 17:02:31 -07:00
Alexey Kiryushin
01103da5d9 fix(client): fix panic when addrs in ConnectingTcpRemote is empty (#2292)
Closes #2291
2020-09-29 11:07:09 -07:00
Sean McArthur
523d66a41f refactor(body): fix unused sync_wrapper when stream feature disabled (#2287) 2020-09-21 13:57:58 -07:00
Sean McArthur
aea9c52808 v0.13.8 2020-09-18 10:44:16 -07:00
Sean McArthur
d8622e570c refactor(http1): include bytes in invalid header name panic (#2286) 2020-09-18 10:08:44 -07:00
Snarpix
187c22afb5 feat(lib): Setting http1_writev(true) will now force writev queue usage
Previously, calling `http1_writev(true)` would just keep the default behavior, which was to auto detect if writev was optimal. Now, the auto-detection is still default, but explicitly calling `http1_writev(true)` will skip the auto-detection, and always use writev queue strategy.

Closes #2282
2020-09-18 09:50:43 -07:00
Sean McArthur
1edf2af377 docs(client): fix broken intra doc link for http::Uri 2020-09-17 13:44:50 -07:00
Danilo Bargen
58a25eb7dc docs(body): Sender: Add a note about abnormal body closing (#2283) 2020-09-17 11:16:20 -07:00
Stefano Buliani
66fc127c8d docs(server): Example for conn modules (#2277)
Add basic, module-level example for the Http struct in the server::conn module that shows how to customize the configuration of the HTTP protocol handling and then serve requests received through a tokio TCP stream.
2020-08-28 11:21:33 -07:00
João Oliveira
1ecbcbb119 fix(http1): return error if user body ends prematurely
- update proto::h1::end_body to return Result<()>
- update Encoder::end to return Error(NotEof) only when there's Content-length left to be addressed

Closes #2263
2020-08-12 14:12:48 -07:00
Sean McArthur
3de81c822e refactor(h1): add spans for parse_headers and encode_headers (#2262) 2020-08-05 13:52:52 -07:00
João Oliveira
6e7e4e2cd5 docs(client): clarify HttpConnector::new_with_resolver doc (#2255)
link to hyper::client::connect::dns, closes #2254
2020-07-29 09:27:46 -07:00
Sean McArthur
25a05894b9 refactor(h1): use httpdate for server date header 2020-07-28 17:48:32 -07:00
Sean McArthur
48f04b6217 test(h1): add benchmarks for server date checking and rendering 2020-07-28 17:14:15 -07:00
JohnMartin95
f4f14b30e3 chore(dependencies): require tokio 0.2.11 (#2252)
Closes #2250
2020-07-28 16:49:09 -07:00
Theodore DeRego
b5d5e21449 feat(server): implement AsRawFd for AddrStream (#2246)
Fixes #2245.
2020-07-16 08:26:46 -07:00
Sean McArthur
4216b2de70 v0.13.7 2020-07-13 17:03:48 -07:00
Sean McArthur
8f6d0a2f7e docs(readme): replace irc links with discord links 2020-07-10 15:35:02 -07:00
David Barsky
9832aef9ee feat(lib): Move from log to tracing in a backwards-compatible way (#2204)
I've moved Hyper from `log` to `tracing`. Existing `log`-based users shouldn't notice a difference, but `tracing` users will see higher performance when filtering data. This isn't the _end_  of the `tracing` integration that can happen in `Hyper` (e.g., Hyper can start using spans, typed fields, etc.), but _something_ is better than nothing. I'd rather address those points, including examples, in followups.

I've attached a screenshot of the `hello` example working, but the logged information is pulled from `tracing`, not `log`.

<img width="514" alt="Screen Shot 2020-05-16 at 1 23 19 PM" src="https://user-images.githubusercontent.com/2067774/82126298-d8103800-9779-11ea-8f0b-57c632c684d6.png">
2020-07-06 18:30:41 -07:00
Daiki Mizukami
77c3b5bc0c feat(client): impl tower_service::Service for &Client (#2089) 2020-06-25 08:18:05 -07:00
Markus Westerlind
07f2fd1775 refactor(h1): use futures::ready! in a few places 2020-06-23 08:06:39 -07:00
Sean McArthur
981d26d5a1 perf(h2): forward Buf::bytes_vectored to SendBuf 2020-06-16 00:08:37 +00:00
Thomas
55ba000746 docs(service): add example of impl Service (#2209)
Add `examples/service_struct_impl.rs`, which provides an up-to-date
example of implementing MakeService and Service on custom types.
The `Svc` struct has a Counter, which demonstrates how to instantiate
shared resources in the `MakeSvc` and pass the resource to the
services. Updates the `examples/README.md` and the doc in
`src/service/mod.rs`.

Closes #1691
2020-06-15 12:01:04 -07:00
Damien Elmes
0d0d363547 fix(client): don't panic in DNS resolution when task cancelled (#2229)
If the runtime is dropped while a DNS request is being made, it can
lead to a panic. This patch checks if the task was cancelled, and
returns a generic IO error instead of panicking in that case.

The following code reproduces the problem on my macOS machine:

```
use hyper::Client;
use tokio::runtime;

type Result<T> = std::result::Result<T, Box<dyn std::error::Error + Send + Sync>>;

fn main() {
    let rt = runtime::Builder::new()
        .threaded_scheduler()
        .core_threads(1)
        .enable_all()
        .build()
        .unwrap();

    // spawn a request and then drop the runtime immediately
    rt.spawn(fetch_url());
}

async fn fetch_url() -> Result<()> {
    let url: hyper::Uri = "http://example.com".parse()?;
    let client = Client::builder().build_http::<hyper::Body>();

    let res = client.get(url).await?;
    println!("Response: {}", res.status());

    Ok(())
}
```
2020-06-11 13:36:17 -07:00
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