217 Commits

Author SHA1 Message Date
ZenTeaCC
ea5b49b7d4 docs(examples): alias Builder for clarity in http_proxy (#3873) 2025-04-07 08:17:10 -04:00
Lin Yihai
0bd4adfed2 refactor(lib): reduce clippy warnings (#3805) 2024-12-06 11:04:54 -05:00
Ion Ionascu
8cf1121977 test(server): fix conditional cfg for tests needing the server feature (#3799)
Update tests that require the server feature to only be compiled when the feature is enabled.
After updating these tests, the server feature is no longer required for the ffi job when
running tests.

Closes #3790
2024-11-29 13:25:22 -05:00
Nihal T M
bb51c81b74 docs(examples): add HTTP/2 server example (#3702)
cc #3568
2024-09-17 09:00:03 -04:00
krakow10
e77cefe3de fix(example): change TokioTimer usage to match hyper-util end-user experience (#3658) 2024-05-10 11:24:07 +08:00
Maxwell Borden
c62ea805b5 docs(example): remove incorrect comment in example (#3656)
There was a comment in the service_struct_impl.rs example indicating
that the default match arm would somehow return a 404 and not increment
the counter. This wasn't the case. That arm also had a redundant return.
2024-05-03 17:20:44 -04:00
crazehang
fabb886785 chore: remove repetitive words in comment (#3619)
Signed-off-by: crazehang <zhangrenzhong@outlook.com>
2024-04-03 21:17:58 +09:00
dswij
8241f91f5b docs(examples): fix client request path (#3520) 2024-01-12 09:45:52 -05:00
19年梦醒
26f8675293 docs(examples): use share data in service (#3503) 2023-12-26 00:08:42 +00:00
ncihnegn
15d97063c4 docs(example): fix typo in upgrade example (#3479) 2023-12-14 11:26:38 -05:00
Sean McArthur
5fdbd30b4a docs(examples): touch up Hello server example 2023-11-24 15:06:50 -05:00
hatoo
abf696aadb docs(example): Update http_proxy example to use (host, port) (#3434) 2023-11-21 09:58:26 -05:00
acedogblast
ea8dffe5ba docs(examples): Improved send_file.rs example to use streaming. (#3433) 2023-11-21 07:17:53 -05:00
tottoto
a475ada1fc docs(examples): update dependencies section 2023-11-16 06:34:18 -05:00
tottoto
8eb2cff120 chore(dependencies): use form_urlencoded crate directly (#3376) 2023-10-28 06:58:42 -04:00
Sean McArthur
cf87eda82c feat(client): allow !Send IO with HTTP/1 client (#3371)
This removes the requirement of the IO type from being `Send` for the
HTTP/1 client connection. To do so, the ability to perform
`hyper::upgrade`s had to be moved to a separate type which does require
the `Send` bound. This mirrors how the server types do it.

The `Connection` type now has a `with_upgrades()` method to convert.

Closes #3363

BREAKING CHANGE: If you use client HTTP/1 upgrades, you must call
  `Connection::with_upgrades()` to still work the same.
2023-10-26 08:27:08 -04:00
Aaron Riekenberg
6a64a22016 docs(examples): Add graceful_shutdown example. (#3303) 2023-09-05 14:13:43 -04:00
Ruben2424
a45d5d5a04 docs(example): document the single-threaded example (#3271) 2023-07-21 14:53:44 -04:00
Ruben2424
4ace340bb0 fix(client): remove Send bounds for request Body (#3266)
Closes #3184
2023-07-18 15:10:32 -04:00
Sean McArthur
f9f65b7aa6 feat(rt): replace IO traits with hyper::rt ones (#3230)
This replaces the usage of `tokio::io::{AsyncRead, AsyncWrite}` in hyper's public API with new traits in the `hyper::rt` module.

Closes #3110

BREAKING CHANGE: Any IO transport type provided must not implement `hyper::rt::{Read, Write}` instead of
  `tokio::io` traits. You can grab a helper type from `hyper-util` to wrap Tokio types, or implement the traits yourself,
  if it's a custom type.
2023-07-10 14:11:06 -04:00
Ruben2424
d977f209bc feat(client): Make clients able to use non-Send executor (#3184)
Closes #3017

BREAKING CHANGE: `client::conn::http2` types now use another generic for an `Executor`.
  Code that names `Connection` needs to include the additional generic parameter.
2023-06-29 16:55:43 -04:00
rob2244
d894439e00 feat(service): change Service::call to take &self (#3223)
change Service::call to take &self instead of &mut self.
Because of this change, the trait bound in the service::util::service_fn and
the trait bound in the impl for the ServiceFn struct were changed from FnMut to Fn.
This change was decided on for the following reasons:
- It prepares the way for async fn,
  since then the future only borrows &self, and thus a Service can concurrently handle
  multiple outstanding requests at once.
- It's clearer that Services can likely be cloned
- To share state across clones you generally need Arc<Mutex<_>>
  that means you're not really using the &mut self and could do with a &self

Closes #3040

BREAKING CHANGE: The Service::call function no longer takes a mutable reference to self.
  The FnMut trait bound on the service::util::service_fn function and the trait bound
  on the impl for the ServiceFn struct were changed from FnMut to Fn.
2023-05-15 15:20:34 -04:00
Isaac Cloos
ea0f0e3698 docs(examples): update dependencies (#3226)
* docs(examples): update dependencies (#3099)

Tested by dropping this batch of dependencies into a freshly gen'd cargo project and copying in every example in turn and making sure it runs.

* Also some spelling and formatting corrections ❤️

* fix(examples): most examples require --features="full" (#3099)
2023-05-15 10:03:40 -04:00
Isaac Cloos
16a921f8d8 docs(example): change suggestion in echo.rs for windows compat (#3220)
The suggested curl statement should work for all users out-of-the-box.

Regression tested against windows, macos, and linux (dev container).
2023-05-05 11:18:19 +00:00
Daniel Sedlak
5679767c8d style(examples): fix typo in gateway example (#3196) 2023-04-06 14:01:33 +00:00
Olive Gould
cd49dcd13d docs(example): add comments to the examples/hello.rs example (#3150) 2023-02-27 17:10:47 -05:00
Sean McArthur
51b45e3f85 feat(body): upgrade to http-body 1.0.0-rc.2 (#3106) 2022-12-29 14:36:18 -05:00
Michael-J-Ward
48e70c691e feat(server): remove http1_ method prefixes from server::conn::http2::Builder
Refs: #3085
2022-12-28 11:29:58 -05:00
Michael-J-Ward
4cbaef79f0 feat(client): remove http1_ prefixes from client::conn::http1::Builder methods
Refs: #3085
2022-12-28 11:29:58 -05:00
Oddbjørn Grødem
9f47576cab docs(examples): re-enable echo uppercase endpoint (#3075) 2022-12-06 16:59:02 -05:00
Sean McArthur
95a153bbc2 feat(body): rename Recv to Incoming (#3022)
The concrete "recv stream" body type is renamed to `Incoming`.

Closes #2971
2022-10-25 16:27:17 -04:00
Sean McArthur
0888623d37 feat(body): update Body trait to use Frames (#3020)
The `Body` trait was adjusted to be forwards compatible with adding new
frame types. That resulted in changing from `poll_data` and `poll_trailers`
to a single `poll_frame` function. More can be learned from the proposal
in https://github.com/hyperium/hyper/issues/2840.

Closes #3010

BREAKING CHANGE: The polling functions of the `Body` trait have been
  redesigned.

  The free functions `hyper::body::to_bytes` and `aggregate` have been
  removed. Similar functionality is on
  `http_body_util::BodyExt::collect`.
2022-10-24 18:07:45 -04:00
Sean McArthur
0766d3f78d feat(server): remove server::conn::{Http, Connection} types (#3013)
The connection types have been split into version-specific types, in the
`server::conn::{http1, http2}` modules.

Closes #3012

BREAKING CHANGE: Either choose a version-specific `Connection` type, or
  look for the auto-version type in `hyper-util`.
2022-10-17 13:23:47 -04:00
Sean McArthur
8ae73cac6a feat(client): remove client::conn::{SendRequest, Connection} (#2987)
BREAKING CHANGE: Pick a version-specific connection, or use the combined
  one in `hyper-util`.

Co-authored-by: mkusaka <hinoshita1992@gmail.com>
2022-09-21 09:20:07 -07:00
Tom Karwowski
fee7d361c2 feat(service): create own Service trait (#2920)
This removes the dependency on `tower-service`, and simplifies the `Service` trait to be used by hyper's server connections.

Closes #2853 

BREAKING CHANGE: Change any manual `impl tower::Service` to implement `hyper::service::Service` instead. The `poll_ready` method has been removed.
2022-09-08 15:25:20 -07:00
Rajiv Sharma
031454e5e6 fest(body): rename HttpBody export to Body (#2969)
Now that the concrete `Body` type has been temporarily replaced with `Recv` in #2966,
we can rename and export `http_body::Body` as just `Body` instead of `HttpBody`.

Closes #2839

BREAKING CHANGE: The trait has been renamed.
2022-08-30 05:55:06 -07:00
Michael J Ward
7a41da5f60 refactor(body): rename Body to Recv temporarily (#2966)
"""
We'll eventually want to bikshed the name Recv, but to free up the name Body for #2839, this can be done quickly.
"""

Closes #2963
2022-08-26 08:47:14 -07:00
Sean McArthur
9e8fc8fca1 feat(body): remove "full" constructors from Body (#2958)
The constructors of `hyper::Body` from a full bytes are removed. Along
with `Body::empty()`.

BREAKING CHANGE: Use the types from `http-body-util`.

Co-authored-by: Xuanwo <github@xuanwo.io>
2022-08-24 13:01:26 -07:00
Sean McArthur
952756b916 docs(examples): include Host header in client examples (#2956) 2022-08-22 14:11:46 -07:00
Andrew Hickman
84f6ae78d6 docs(example): fix http_proxy to use upgrades (#2953) 2022-08-19 13:21:15 -07:00
Sean McArthur
5a5db00f61 docs(examples): add a length check to reversed echo route (#2952) 2022-08-19 13:09:46 -07:00
Sean McArthur
889fa2d872 feat(client): remove hyper::client::server (#2940)
BREAKING CHANGE: Tower `Service` utilities will exist in `hyper-util`.
2022-08-12 13:54:45 -07:00
Sean McArthur
0c8ee93d7f feat(client,server): remove tcp feature and code (#2929)
This removes the `tcp` feature from hyper's `Cargo.toml`, and the code it enabled:

- `HttpConnector`
- `GaiResolver`
- `AddrStream`

And parts of `Client` and `Server` that used those types. Alternatives will be available in the `hyper-util` crate.

Closes #2856 
Co-authored-by: MrGunflame <mrgunflame@protonmail.com>
2022-07-29 10:07:09 -07:00
Oddbjørn Grødem
ce72f73464 feat(lib): remove stream cargo feature (#2896)
Closes #2855
2022-06-23 15:12:24 -07:00
Rafael Ávila de Espíndola
1d553e52c6 feat(server): Remove Send + Sync requirement for Body in with_graceful_shutdown
Also expand the single threaded example to use that.
2021-10-12 16:47:03 -07:00
Rafael Ávila de Espíndola
7feab2f3db test(server): Use a !Send and !Sync HttpBody in an example
The default Body type is used in the client in a Pool, so it has to be
Send. On the server, we can use a !Send type if the executor is single
threaded.

Expand the existing example to show that.
2021-10-12 16:47:03 -07:00
Dai Dao
3908eeb788 docs(examples): updated imports in client_json example (#2412) 2021-09-16 16:34:10 -07:00
Sean McArthur
e3ab409808 refactor(lints): fix unused warnings in tests/docs 2021-09-14 16:50:22 -07:00
0x79756b69
f70c8ffc7b docs(example): add a get query method to params example (#2601) 2021-07-21 09:09:38 -07:00
telotic
4e9a006498 docs(example): support requests to domain names in example http_proxy (#2513) 2021-04-28 17:07:03 -07:00