2522 Commits

Author SHA1 Message Date
David Pedersen
8a05f8eec1 docs(server): add bigger example to server module (#2539)
It can sometimes be tricky to discover where to use `move` closures,
`async move {}`, and `.clone()` when creating a server. This adds a
slightly more bigger example that will hopefully help some.

Fixes https://github.com/hyperium/hyper/issues/2446
2021-05-11 16:56:01 -07:00
David Pedersen
e79d09396d docs(client): document the guarantees of cloning a Client (#2540)
Small docs improvement to mention that cloning a `Client` is cheap and
will reuse the connection pool.

Fixes https://github.com/hyperium/hyper/issues/2239
2021-05-06 13:48:53 -07:00
Mohsen Alizadeh
d1d2f32a73 docs(headers): no_inline doc on HeaderMap (#2525) 2021-05-03 13:58:34 -07:00
telotic
4e9a006498 docs(example): support requests to domain names in example http_proxy (#2513) 2021-04-28 17:07:03 -07:00
Sean McArthur
963dc23f0d v0.14.7 2021-04-22 09:52:41 -07:00
Anthony Ramine
4fd6c4cb0b feat(server): implement forgotten settings for case preserving 2021-04-22 09:50:46 -07:00
ty
a303b3c329 fix(http1): http1_title_case_headers should move Builder 2021-04-22 09:50:46 -07:00
Sean McArthur
7f69d8f94c v0.14.6 2021-04-21 16:19:31 -07:00
Anthony Ramine
dbea7716f1 feat(http1): add options to preserve header casing (#2480)
Decouple preserving header case from FFI:

The feature is now supported in both the server and the client
and can be combined with the title case feature, for headers
which don't have entries in the header case map.

Closes #2313
2021-04-21 09:50:35 -07:00
Sean McArthur
117cc492a6 chore(ci): quiet the warnings when verifying the generated header file (#2507) 2021-04-20 17:23:10 -07:00
Anthony Ramine
11345394d9 feat(client): add option to allow misplaced spaces in HTTP/1 responses (#2506) 2021-04-20 14:17:48 -07:00
Kevin Burke
ed2fdb7b6a chore(ffi): fix compile errors and warnings (#2492)
As I understand it, "cargo rustc" in gen_header.sh generates a ton of
errors, but still manages to generate an object that can be used by
cbindgen to generate hyper.h.

However, I tried to make a separate change to add more fields to
hyper.h, and learned that "cargo rustc" stops if it reaches 50 errors,
which I reached. I was able to buy some headroom and fix a number of
the compilation errors by adding imports to the fake Cargo.toml we
generate in gen_header.sh.

I wasn't sure how to resolve imports like "crate::Result" which appear
to reference the top-level src/error.rs, and print an error when they
are compiled in gen_header.sh. But I only need to buy headroom under
the 50 error count for now, which I was able to do by adding the
imports.

It is possible that someone more familiar with Rust than me could look
at this and know what to change to get the total number of errors to
zero.
2021-04-07 16:12:02 -07:00
Kevin Burke
aa4a2eaa44 chore(LICENSE): update license year (#2491) 2021-04-06 14:49:37 -07:00
Kevin Burke
a5464f761a chore(ffi): run gen_header.sh in CI environment (#2488)
Clean up the script so that any unexpected error terminates the
script, and stop suppressing errors that may contain useful
information (for example, that you are using the stable version but
need to use the nightly).

This is useful because if hyper.h is not up to date going forward the
CI should flag it. As is, there are a bunch of changes to hyper.h that
have not been checked in (or were generated by a newer version of the
cbindgen script.)

Fixes #2483.
2021-04-06 14:46:14 -07:00
Kevin Burke
c7ab1aace1 docs(ffi): spelling error (#2489) 2021-04-06 11:40:02 -07:00
Thomas de Zeeuw
d84c794bad chore(ci): Increase MSRV to 1.46 (#2486)
Socket2 v0.4 requires Rust 1.46.
2021-04-06 10:46:21 -07:00
pyfisch
96f7222435 chore(dependencies): Update httpdate to v1.0 (#2485)
Previous version would return wrong results for `Ord`.
2021-04-06 10:43:01 -07:00
Sean McArthur
98e7e0bd15 v0.14.5 2021-03-26 12:03:24 -07:00
Rasmus Nylander
895e4cf3fb refactor(ffi): return null ptr instead of aborting in C API (#2478)
Make C API functions that return pointers return null in case of a
panic, instead of aborting.

Add ffi_fn! macro rules that enable default error values to be returned
by writing "?= <value>" after an ffi function's body.
2021-03-26 11:26:44 -07:00
Anthony Ramine
68d4e4a3db feat(client): allow HTTP/0.9 responses behind a flag (#2473)
Fixes #2468
2021-03-26 11:25:00 -07:00
Vagelis Prokopiou
51ed71b0a6 docs(client): use Method::POST to match the example in https://hyper.rs/guides/client/advanced/ (#2479) 2021-03-25 13:34:03 -07:00
Thomas de Zeeuw
41f99578a5 refactor(dependencies): update to socket2 v0.4.0 (#2472) 2021-03-22 15:16:31 -07:00
Vincent Ricard
48fdaf1606 fix(headers): Support multiple Content-Length values on same line (#2471)
Closes #2470
2021-03-19 10:38:58 -07:00
Danilo Bargen
eb0e718696 docs(body): add links to to_bytes and aggregate (#2464)
Since these two functions are not methods on the `Body`, they aren't
very discoverable. So a note in the docs would definitely be helpful.
2021-03-15 15:40:28 -07:00
kolapapa
297a068454 docs(examples): upgrade tokio version (#2456) 2021-03-10 10:00:39 -08:00
0x79756b69
34085afef6 docs(examples): use hyper v0.14 and full feature (#2451) 2021-03-08 14:19:24 -08:00
Peter Smit
8cbf9527df fix(server): skip automatic Content-Length headers when not allowed (#2216)
Closes #2215
2021-03-04 17:03:33 -08:00
Sean McArthur
f162ca2f2f docs(ffi): generate FFI documentation (#2447) 2021-02-26 19:00:37 -08:00
ty
4c946af49c feat(server): add AddrIncoming::from_listener constructor (#2439) 2021-02-22 16:18:38 -08:00
CfirTsabari
a60280873b refactor(ffi): Removed need for cbindgen type renames (#2442)
Fixes hyperium/hyper#2428
2021-02-22 16:12:06 -08:00
CfirTsabari
0b11eee9bd fix(client): omit default port from automatic Host headers (#2441)
Fixes hyperium/hyper#2407
2021-02-22 11:33:28 -08:00
David Pedersen
6efc1a1cce docs(server): add server example using tower::make::Shared (#2440)
`tower` 0.4.5 introduced `Shared` which is a `MakeService` that produces
services by cloning an inner service. This works quite well with `hyper`
if your service doesn't need the incoming connection and implements
`Clone`.

However that might not be entirely obvious so I thought it made sense to
add an example to the docs.

I wasn't quite sure if the example should go in the server or service
module docs but since there already is an example using
`make_service_fn` in the server docs I opted to add it there. Let me
know if you'd rather have it somewhere else.
2021-02-19 13:50:43 -08:00
Markus Westerlind
f01de8e503 refactor(client): Use async/await more (#2437)
* refactor: Use async/await in client.rs

* refactor: Simplify client.rs a bit more

* refactor: Allow !Unpin in Lazy

* Remove some impl Future

* Remove some combinator use
2021-02-18 10:35:43 -08:00
Arnavion
42587059e6 docs(server): use cfg_feature! on hyper::server::conn::tcp instead of #[cfg]
This is required to surface the required feature (`tcp`) in the generated docs
for `hyper::server::conn::{AddrIncoming, AddrStream}`. Before this change,
their docs only mentioned the features needed for the `hyper::server::conn` mod
itself.

Fixes #2425
2021-02-09 13:31:41 -08:00
Taiki Endo
dfa1bb291d chore(ci): use --feature-powerset --depth 2 in features check 2021-02-06 07:36:04 -08:00
Taiki Endo
95ce96048c test(http1): fix non_fmt_panic warning (#2424) 2021-02-06 07:20:01 -08:00
Sean McArthur
196d9bd69c v0.14.4 2021-02-05 15:54:38 -08:00
Sean McArthur
4445e736ba refactor(client): fix unused Pin import without http2 2021-02-05 15:51:56 -08:00
Sean McArthur
7390f026d7 Revert "refactor(lib): Switch from pin-project to pin-project-lite"
This reverts commit 43412a950f.
2021-02-05 15:51:56 -08:00
Sean McArthur
48d4594930 v0.14.3 2021-02-05 14:11:35 -08:00
Sean McArthur
8f93123efe fix(http1): fix server misinterpretting multiple Transfer-Encoding headers
When a request arrived with multiple `Transfer-Encoding` headers, hyper
would check each if they ended with `chunked`. It should have only
checked if the *last* header ended with `chunked`.

See https://github.com/hyperium/hyper/security/advisories/GHSA-6hfq-h8hq-87mf
2021-02-05 14:10:02 -08:00
Michal 'vorner' Vaner
4d2125c67c perf(body): specialize BufList::copy_to_bytes (#2413)
Some implementations of the Buf trait have an optimized version (for
example Bytes) of copy_to_bytes, opportunistically use that one.
2021-02-02 17:09:06 -08:00
Michal 'vorner' Vaner
5e8238c1b8 docs(body): warn about no length check in aggregate (#2415)
The to_bytes and aggregate don't check how long the body is, so the user
better be aware.

Relates to #2414.
2021-02-02 09:34:40 -08:00
Jonas Platte
43412a950f refactor(lib): Switch from pin-project to pin-project-lite 2021-01-28 14:09:53 -08:00
Jonas Platte
9dff00425d refactor(lib): Use cfg(all(...)) instead of multiple cfg attributes 2021-01-28 14:09:53 -08:00
Ivan Nikulin
2c8121f173 fix(client): HTTP/1 client "Transfer-Encoding" repair code would panic (#2410)
Closes #2409
2021-01-26 10:36:58 -08:00
Sean McArthur
1928682b33 feat(ffi): add HYPERE_INVALID_PEER_MESSAGE error code for parse errors 2021-01-20 15:10:19 -08:00
Paolo Barbolini
237b2ce083 refactor(lib): Remove useless uses of Pin (#2405) 2021-01-19 14:51:34 -08:00
erikdesjardins
9956587f83 feat(body): reexport hyper::body::SizeHint (#2404) 2021-01-19 14:50:07 -08:00
Mike Roelens
ec2fd4a15f docs(client): fix typo in httpbin.org domain (#2406) 2021-01-19 08:30:17 -08:00