Commit Graph

2361 Commits

Author SHA1 Message Date
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
nickelc
f821ecdd19 docs(body): set doc_cfg attribute for Body::wrap_stream (#2403) 2021-01-15 16:24:03 -08:00
Abdullah Eryuzlu
bf8d74ad1c feat(body): add send_trailers to Body channel's Sender (#2387)
Closes #2260
2021-01-15 10:14:21 -08:00
nickelc
257d6a9919 docs(server): set doc_cfg attributes for tcp feature gated Server methods (#2401) 2021-01-14 13:56:49 -08:00
Taiki Endo
f0ddb66932 refactor(lib): apply unreachable_pub lint (#2400)
Closes #2390
2021-01-14 09:57:55 -08:00
Markus Westerlind
a15f3f7f0f refactor(client): minimize the amount of instantiated code (#2391)
* Halve the amount of conn_task instantiations
* Extract non-generic parts of client::handshake
* Extract the non-generic parts of call_async
2021-01-12 16:18:22 -08:00
Sean McArthur
446dd2f0c7 chore(security): add a SECURITY.md policy (#2395) 2021-01-12 14:45:10 -08:00
Sean McArthur
c9c46ed60b refactor(ffi): Add Reason-Phrase API
This adds an internal ability to copy the HTTP/1 reason-phrase and place
it in the `http::Extensions` of a response, if it doesn't match the
canonical reason. This could be exposed in the Rust API later, but for
now it is only used by the C API.
2021-01-08 10:25:53 -08:00
Sean McArthur
4c32daeea0 refactor(ffi): Add HeaderCaseMap preserving http1 header casing 2021-01-08 10:25:53 -08:00
Sean McArthur
3ae1581a53 feat(ffi): Initial C API for hyper 2021-01-08 10:25:53 -08:00
Sean McArthur
8861f9a786 v0.14.2 2020-12-29 10:51:50 -08:00
Kirill Fomichev
a6d4fcbee6 feat(server): expose Accept without httpX features (#2382) 2020-12-29 10:19:57 -08:00