Commit Graph

2493 Commits

Author SHA1 Message Date
Sean McArthur
4b6099c7aa feat(body): implement HttpBody for Request and Response
When the body type of a `Request` or `Response` implements `HttpBody`,
the `Request` or `Response` itself now implements `HttpBody`.

This allows writing things like `hyper::body::aggregate(req)` instead of
`hyper::body::aggregate(req.into_body())`.

Closes #2067
2019-12-13 10:48:30 -08:00
Euclidr
bfda390617 docs(server): http_proxy example 2019-12-12 16:59:38 -08:00
Sean McArthur
703ac340cb docs(body): fill in documentation of the to_bytes function 2019-12-12 15:26:54 -08:00
Sean McArthur
cb71d2cdbd fix(http1): fix response with non-chunked transfer-encoding to be close-delimited
Closes #2058
2019-12-12 14:26:56 -08:00
Sean McArthur
e12329054a refactor(http1): fix for unused must_use on read_buf.split_to 2019-12-12 14:17:33 -08:00
Sean McArthur
d1f6136ce2 test(http1): only enable WriteBuf non-empty test with debug-assertions
Closes #2062
2019-12-12 12:12:32 -08:00
Sean McArthur
2553ea1a7a feat(client): expose hyper::client::connect::Connect trait alias
This is *just* a "trait alias". It is automatically implemented for all
`Service<Uri>`s that have the required bounds. It's purpose being public
is to ease setting trait bounds outside of hyper. Therefore, it doesn't
have any exposed associated types, to prevent otherwise relying on any
super-traits that hyper requires.
2019-12-12 11:58:05 -08:00
Sean McArthur
a07142da2d refactor(client): remove Unpin requirement from request body 2019-12-11 14:18:56 -08:00
Sean McArthur
52cc3f7367 refactor(client): remove Unpin requirement on Body::Data 2019-12-11 14:18:56 -08:00
Sean McArthur
57ef271500 docs(lib): fix broken intra docs links 2019-12-11 13:23:36 -08:00
Sean McArthur
bdca4992fc chore(CI): add cargo doc step to CI 2019-12-11 13:23:36 -08:00
Sean McArthur
e0ea2aeeca docs(server): fix ICE documenting pub(super) through pin_project 2019-12-11 13:23:36 -08:00
Sean McArthur
070c84ec43 v0.13.0 2019-12-10 09:45:42 -08:00
Frank Denis
164feec941 docs(client): a custom connector must be implement the Clone trait (#2064) 2019-12-10 09:35:39 -08:00
Sean McArthur
f45137ad6d refactor(server): remove deprecated API 2019-12-09 13:17:47 -08:00
David Barsky
c775525109 docs(lib): fix typo in README.md 2019-12-09 13:04:15 -08:00
Sean McArthur
5b48ec0fe5 docs(lib): rewrite hyper overview 2019-12-09 11:50:53 -08:00
Sean McArthur
78e8da17cf docs(body): small wording improvement to body module docs 2019-12-06 15:50:02 -08:00
Sean McArthur
86fbbad49e docs(server): tweaks to server doc example 2019-12-06 15:50:02 -08:00
Sean McArthur
7e91029e0e docs(client): update client example to use to_bytes 2019-12-06 15:50:02 -08:00
Sean McArthur
245fa9c44c refactor(server): remove Unpin requirement from the Body generic 2019-12-06 13:27:08 -08:00
Sean McArthur
71101e701f docs(client): show how to implement a Connector 2019-12-06 11:58:01 -08:00
Sean McArthur
8ba9a8d2c4 feat(body): add body::aggregate and body::to_bytes functions
Adds utility functions to `hyper::body` to help asynchronously
collecting all the buffers of some `HttpBody` into one.

- `aggregate` will collect all into an `impl Buf` without copying the
  contents. This is ideal if you don't need a contiguous buffer.
- `to_bytes` will copy all the data into a single contiguous `Bytes`
  buffer.
2019-12-06 10:03:05 -08:00
Sean McArthur
5a59875742 feat(body): replace Chunk type with Bytes
Closes #1931

BREAKING CHANGE: All usage of `hyper::Chunk` should be replaced with
  `bytes::Bytes` (or `hyper::body::Bytes`).
2019-12-05 17:22:13 -08:00
Sean McArthur
c56ccfb033 chore(ci): remove .appveyor.yml file 2019-12-05 14:08:40 -08:00
Sean McArthur
a1e87c7fe6 chore(README): update CI badge 2019-12-05 14:08:02 -08:00
Sean McArthur
0dc89680cd style(lib): run rustfmt and enforce in CI 2019-12-05 13:55:17 -08:00
Sean McArthur
b0060f277e chore(CI): enable GitHub Actions 2019-12-05 13:12:35 -08:00
David Barsky
edbd10ac96 feat(client): impl tower_service::Service for Client 2019-12-05 11:37:43 -08:00
Sean McArthur
0b03b73053 feat(lib): rename unstable-stream feature to stream and enable by default
Closes #2034
2019-12-04 17:09:10 -08:00
Sean McArthur
aa66de4f27 refactor(h1): un-split record_header_indicies for ARM 2019-12-04 16:58:35 -08:00
Sean McArthur
a738d03fd3 chore(dependencies): update to http-body 0.3 2019-12-04 16:48:06 -08:00
Sean McArthur
4d7a2266b8 feat(client): change connectors to return an impl Connection
Instead of returning a tuple `(impl AsyncRead + AsyncWrite, Connected)`,
this adds a new trait, `hyper::client::connect::Connection`, which
allows querying the connection type for a `Connected`.

BREAKING CHANGE: Connectors no longer return a tuple of
  `(T, Connected)`, but a single `T: Connection`.
2019-12-04 16:15:28 -08:00
Sean McArthur
319e8aee15 feat(client): remove Destination for http::Uri in connectors
BREAKING CHANGE: All usage of `hyper::client::connect::Destination`
  should be replaced with `http::Uri`.
2019-12-04 16:15:28 -08:00
Sean McArthur
9645a125e6 refactor(client): return HttpConnecting newtype 2019-12-04 14:06:16 -08:00
Markus Westerlind
30ac01c180 refactor(client): use async/await in HttpConnector (#2019)
Closes #1984
2019-12-04 13:39:56 -08:00
David Barsky
19a7aab51f chore(dependencies): update tower-service to 0.3 2019-12-04 12:13:14 -08:00
Sean McArthur
c63728eb38 feat(body): replace the Payload trait with HttpBody
The `hyper::body::HttpBody` trait is a re-export from the `http-body`
crate. This allows libraries to accept "HTTP bodies" without needing to
depend on hyper.

BREAKING CHANGE: All usage of `hyper::body::Payload` should be replaced
  with `hyper::body::HttpBody`.
2019-12-04 11:57:13 -08:00
Adam C. Foltzer
3cc93e796a feat(server): give Server::local_addr a more general type
Allows `local_addr` to work for any executor type, rather than just the default `Exec`. The
underlying `SpawnAll::local_addr()` is already similarly general, so no other changes are needed
other than adding the extra type parameter to the `impl`.
2019-12-04 11:49:28 -08:00
Sean McArthur
6ae5889f83 feat(rt): introduce rt::Executor trait
The `hyper::rt::Executor` trait allows defining custom executors to be
used with hyper's `Client` and `Server`.

Closes #1944

BREAKING CHANGE: Any type passed to the `executor` builder methods must
  now implement `hyper::rt::Executor`.

  `hyper::rt::spawn` usage should be replaced with `tokio::task::spawn`.

  `hyper::rt::run` usage should be replaced with `#[tokio::main]` or
  managing a `tokio::runtime::Runtime` manually.
2019-12-04 11:38:23 -08:00
Sean McArthur
cb3f39c2dc feat(lib): update Tokio, bytes, http, h2, and http-body 2019-12-04 10:56:34 -08:00
James Le Cuirot
131962c86a feat(client): filter remote IP addresses by family of given local IP address
It is not possible to connect to an IPv4 address from an IPv6 address or
vice-versa so don't waste time trying. If no remote addresses match then a
"missing connect error" will now occur.
2019-11-19 10:36:07 -08:00
Daniel Johnson
71d088d3d0 chore(dependencies): update futures to 0.3.1 2019-11-14 10:04:16 -08:00
Sean McArthur
9d9233ce7c feat(client): change Resolve to be Service<Name>
Closes #1903

BREAKING CHANGE: The `Resolve` trait is gone. All custom resolves should
  implement `tower::Service` instead.

  The error type of `HttpConnector` has been changed away from
  `std::io::Error`.
2019-11-12 13:08:39 -08:00
Sean McArthur
039281b89c fix(client): fix polling dispatch channel after it has closed 2019-10-30 14:34:19 -07:00
Dirkjan Ochtman
de5dcd7865 refactor(lib): use dedicated enums for connection protocol versions
This should make it easier to add H3 functionality.
2019-10-30 14:03:29 -07:00
Sean McArthur
e6027bc02d fix(client): fix panic from unreachable code 2019-10-30 13:45:23 -07:00
Sean McArthur
b5e70a0dd1 refactor(server): remove more 'static bounds on Server 2019-10-24 13:37:11 -07:00
Sean McArthur
8b878a805a perf(client): change HttpConnecting to hold Arc<Config> instead of inlined fields 2019-10-23 16:21:51 -07:00
Sean McArthur
f71304b449 refactor(client): use pin_project for Resolve futures 2019-10-23 14:37:03 -07:00