Commit Graph

2493 Commits

Author SHA1 Message Date
Sean McArthur
9b69cbc254 v0.14.10 2021-07-07 11:33:08 -07:00
Sean McArthur
1fb719e0b6 fix(http1): reject content-lengths that have a plus sign prefix
The HTTP/1 content-length parser would accept lengths that were prefixed
with a plus sign (for example, `+1234`). The specification restricts the
content-length header to only allow DIGITs, making such a content-length
illegal. Since some HTTP implementations protect against that, and
others mis-interpret the length when the plus sign is present, this
fixes hyper to always reject such content lengths.

See GHSA-f3pg-qwvg-p99c
2021-07-07 11:33:08 -07:00
Sean McArthur
1068b994df fix(http1): protect against overflow in chunked decoder
The HTTP/1 chunked decoder, when decoding the size of a chunk, could
overflow the size if the hex digits were too large. This fixes it by
adding an overflow check in the decoder.

See GHSA-5h46-h7hh-c6x9
2021-07-07 11:33:08 -07:00
Sean McArthur
11cb4725ad refactor(http2): fix unstable name clash of Cursor::remaining 2021-07-07 10:10:08 -07:00
Sean McArthur
13594c377d chore(github): merge duplicate issue templates 2021-06-24 10:23:39 -07:00
Sean McArthur
c60a9dd9c9 chore(github): add issue templates 2021-06-24 10:21:21 -07:00
Sean McArthur
8c89a8c166 feat(ffi): add option to get raw headers from response 2021-06-15 08:43:50 -07:00
Sean McArthur
08b2138e40 refactor(error): add header parse error details in hyper::Error
When a header parse error is because of content-length or
transfer-encoding semantics, include a better error message in the
`hyper::Error`.
2021-06-11 07:15:31 -07:00
Sean McArthur
ea8b0cd86e refactor(error): remove PartialEq derives for error kind enums
Replaced the comparisons with `matches!`. This should reduce a bit of
code generation that isn't really needed.
2021-06-08 05:47:11 -07:00
Sean McArthur
8b71a67413 v0.14.9 2021-06-07 12:52:37 -07:00
bensadiku
55d9a584b1 refactor(http1): return Parse::Internal error if there's an illegal header name or value (#2544) 2021-06-04 15:17:37 -07:00
Jonas Platte
6a6a24030e refactor(lib): Switch from pin-project to pin-project-lite (#2566)
Note the practical affects of this change:

- Dependency count with --features full dropped from 65 to 55.
- Time to compile after a clean dropped from 48s to 35s (on a pretty underpowered VM).

Closes #2388
2021-06-04 14:57:27 -07:00
Sean McArthur
0d82405a7b refactor(http1): emit trace logs when buffering write data 2021-06-01 18:21:15 -07:00
Sean McArthur
eb0c646395 fix(http1): reduce memory used with flatten write strategy
If the write buffer was filled with large bufs from the user, such that
it couldn't be fully written to the transport, the write buffer could
start to grow significantly as it moved its cursor without shifting over
the unwritten bytes.

This will now try to shift over the unwritten bytes if the next buf
wouldn't fit in the already allocated space.
2021-05-27 09:02:05 -07:00
Sean McArthur
e61b494e3b v0.14.8 2021-05-25 08:12:49 -07:00
Anthony Ramine
5442b6fadd feat(http2): Implement Client-side CONNECT support over HTTP/2 (#2523)
Closes #2508
2021-05-24 18:20:44 +00:00
Geoffry Song
be9677a1e7 feat(http2): allow HTTP/2 requests by ALPN when http2_only is unset (#2527) 2021-05-19 10:01:20 -07:00
Sean McArthur
4cd06bf256 perf(http2): slow adaptive window pings as the BDP stabilizes (#2550)
This introduces a delay to sending a ping to calculate the BDP that
becomes shorter as the BDP is changing, to improve throughput quickly,
but then also becomes longer as the BDP stabilizes, to reduce the amount
of pings sent. This improved the performance of the adaptive window
end_to_end benchmark.

It should also reduce the amount of pings the remote has to deal with,
hopefully preventing hyper from triggering ENHANCE_YOUR_CALM errors.
2021-05-18 14:12:15 -07:00
Adam C. Foltzer
960a69a587 feat(error): add Error::is_parse_too_large and Error::is_parse_status methods (#2538)
The discussion in #2462 opened up some larger questions about more comprehensive approaches to the
error API, with the agreement that additional methods would be desirable in the short term. These
methods address an immediate need of our customers, so I would like to get them in first before we
flesh out a future solution.

One potentially controversial choice here is to still return `true` from `is_parse_error()` for
these variants. I hope the naming of the methods make it clear that the new predicates are
refinements of the existing one, but I didn't want to change the behavior of `is_parse_error()`
which would require a major version bump.
2021-05-12 18:30:28 -07:00
boxdot
b9916c4101 feat(client): allow to config http2 max concurrent reset streams (#2535)
Setting streams to 0 makes h2 work on wasm platforms without a
`Instant::now` implementation.
2021-05-13 01:24:41 +00:00
Sean McArthur
ccba59fb1b docs(common): remove favicon doc from sync_wrapper module (#2548) 2021-05-13 00:51:45 +00:00
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