643 Commits

Author SHA1 Message Date
4JX
b088466fea Switch pseudo header order to mimic chrome
Some checks failed
CI / Check Style (push) Has been cancelled
CI / Test (beta) (push) Has been cancelled
CI / Test (nightly) (push) Has been cancelled
CI / Test (stable) (push) Has been cancelled
CI / Check MSRV (1.56) (push) Has been cancelled
2022-08-17 19:06:56 +02:00
4JX
7c45fd1657 Merge branch 'hyperium:master' into master 2022-08-17 15:40:32 +00:00
4JX
ee6d3fd5e1 Add a setter for header_table_size 2022-08-17 17:13:12 +02:00
Lucio Franco
88b0789254 v0.3.14 2022-08-16 15:29:08 -07:00
4JX
d05d0a7a93 Uncomment set_header_table_size 2022-08-16 16:34:15 +02:00
Erèbe - Romain Gerard
b0f54d80f2 Use RST_STREAM(NO_ERROR) in case server early respond (#633) (#634)
Http2 Server are allowed to early respond without fully
  consuming client input stream, but must respond with an
  error code of NO_ERROR when sending RST_STREAM.
  Nginx treat any other error code as fatal if not done so

  Commit change error code from CANCEL to NO_ERROR, when the
  server is early responding to the client

  https://github.com/hyperium/h2/issues/633
  https://trac.nginx.org/nginx/ticket/2376
2022-08-15 14:08:56 -07:00
Miguel Guarniz
756384f4cd Replace internal PollExt trait with Poll inherent methods (#625)
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-07-18 16:23:52 -07:00
Sean McArthur
fd4040d90d Bump MSRV to 1.56 (#626) 2022-07-18 16:07:28 -07:00
Ryan Russell
e4cf88c1a1 Fix Typo received (#620)
Signed-off-by: Ryan Russell <git@ryanrussell.org>
2022-06-01 17:21:06 -05:00
Bruce Guenter
f6aa3be671 Add Error::is_reset function (#618) 2022-05-18 16:23:40 -07:00
David Koloski
dc7aa8e0f2 tests: move unexported macro doctest into unit test (#616)
Nightly has begun running doctests for unexported macros as of
https://github.com/rust-lang/rust/pull/96630, which caused a doctest for
test_unpack_octets_4 which was previously ignored to be run. This broke
the CI because macros that are not exported with `#[macro_export]`
cannot be used from external crates (and thus cannot be doctested). This
change ignores the doctest and copies the relevant code into a unit
test.

Co-authored-by: David Koloski <dkoloski@google.com>
2022-05-18 11:23:52 -07:00
Sean McArthur
3a0c622f0c v0.3.13 2022-03-31 16:30:24 -07:00
Dirkjan Ochtman
a54d9265b7 Upgrade tokio-util to 0.7 2022-03-29 05:54:29 -07:00
Eliza Weisman
3383ef71e2 v0.3.12
# 0.3.12 (March 9, 2022)

* Avoid time operations that can panic (#599)
* Bump MSRV to Rust 1.49 (#606)
* Fix header decoding error when a header name is contained at a continuation
  header boundary (#589)
* Remove I/O type names from handshake `tracing` spans (#608)
2022-03-09 11:00:00 -08:00
Eliza Weisman
b8eab381c0 tracing: remove I/O type names from handshake spans (#608)
## Motivation

Currently, the `tracing` spans for the client and server handshakes
contain the name of the I/O type. In some cases, where nested I/O types
are in use, these names can be quite long; for example, in Linkerd, we
see log lines like this:

```
2022-03-07T23:38:15.322506670Z [ 10533.916262s] DEBUG ThreadId(01) inbound:accept{client.addr=192.168.1.9:1227}:server{port=4143}:direct:gateway{dst=server.echo.svc.cluster.local:8080}:server_handshake{io=hyper::common::io::Rewind<linkerd_io::either::EitherIo<linkerd_io::sensor::SensorIo<linkerd_io::prefixed::PrefixedIo<linkerd_io::either::EitherIo<tokio_rustls::server::TlsStream<linkerd_io::either::EitherIo<linkerd_io::scoped::ScopedIo<tokio::net::tcp::stream::TcpStream>, linkerd_io::prefixed::PrefixedIo<linkerd_io::scoped::ScopedIo<tokio::net::tcp::stream::TcpStream>>>>, linkerd_io::either::EitherIo<linkerd_io::scoped::ScopedIo<tokio::net::tcp::stream::TcpStream>, linkerd_io::prefixed::PrefixedIo<linkerd_io::scoped::ScopedIo<tokio::net::tcp::stream::TcpStream>>>>>, linkerd_transport_metrics::sensor::Sensor>, linkerd_io::sensor::SensorIo<linkerd_io::either::EitherIo<tokio_rustls::server::TlsStream<linkerd_io::either::EitherIo<linkerd_io::scoped::ScopedIo<tokio::net::tcp::stream::TcpStream>, linkerd_io::prefixed::PrefixedIo<linkerd_io::scoped::ScopedIo<tokio::net::tcp::stream::TcpStream>>>>, linkerd_io::either::EitherIo<linkerd_io::scoped::ScopedIo<tokio::net::tcp::stream::TcpStream>, linkerd_io::prefixed::PrefixedIo<linkerd_io::scoped::ScopedIo<tokio::net::tcp::stream::TcpStream>>>>, linkerd_transport_metrics::sensor::Sensor>>>}:FramedWrite::buffer{frame=Settings { flags: (0x0), initial_window_size: 65535, max_frame_size: 16384 }}: h2::codec::framed_write: send frame=Settings { flags: (0x0), initial_window_size: 65535, max_frame_size: 16384 }
```

which is kinda not great.

## Solution

This branch removes the IO type's type name from the spans for the
server and client handshakes. In practice, these are not particularly
useful, because a given server or client instance is parameterized over
the IO types and will only serve connections of that type.
2022-03-08 15:54:31 -08:00
hikaricai
85549fca19 fix header parsing: consume buf only if header name and value are both decoded
Decoding error when processing continuation header which contains normal
header name at boundary
2022-02-23 17:09:04 -08:00
Sean McArthur
7bb14625ba Bump MSRV to 1.49, since Tokio uses it 2022-02-23 17:07:32 -08:00
Dirkjan Ochtman
4c31a320be Upgrade dev-dependencies 2022-02-11 09:21:28 -08:00
lucas
47e9f62fb5 There's no such thing as HTTP/2.0 2022-02-07 08:52:25 -08:00
Oliver Gould
4dc2b4a164 Avoid time operations that can panic
We have reports of runtime panics (linkerd/linkerd2#7748) that sound a
lot like rust-lang/rust#86470. We don't have any evidence that these
panics originate in h2, but there is one use of `Instant::sub` that
could panic in this way.

Even though this is almost definitely a bug in Rust, it seems most
prudent to actively avoid the uses of `Instant` that are prone to this
bug. These fixes should ultimately be made in the standard library, but
this change lets us avoid this problem while we wait for those fixes.

This change replaces uses of `Instant::elapsed` and `Instant::sub` with
calls to `Instant::saturating_duration_since` to prevent this class of
panic.

See also hyperium/hyper#2746
2022-01-31 16:22:32 -08:00
Anthony Ramine
b0d01bb200 v0.3.11 2022-01-26 10:11:35 -08:00
Anthony Ramine
556447c130 Make use of NLL to clean up handshaking logic (#576) 2022-01-26 11:18:28 +01:00
Sean McArthur
7de2ccc1a3 fix panic when receiving already reset push promise (#597)
Found by oss-fuzz
2022-01-21 15:41:39 -08:00
Anthony Ramine
a28a39ca4a Update tracing-subscriber and use tracing-tree when testing (#586)
This makes reading the logs way easier on the eyes.
2022-01-21 10:59:11 -08:00
Anthony Ramine
d92ba1c45b Make SendStream::poll_capacity never return Ok(Some(0)) (#596)
Fixes #270
2022-01-19 10:49:53 -08:00
Sean McArthur
b949d6ef99 v0.3.10 2022-01-06 17:09:42 -08:00
Sean McArthur
6336cc3d7b Add Error::is_go_away() and Error::is_remote() 2022-01-06 15:53:38 -08:00
Sean McArthur
c876dda6d0 Fix panic when receiving malformed push promise with stream id 0 2021-12-09 15:27:36 -08:00
Sean McArthur
308663e71e v0.3.9 2021-12-09 09:29:24 -08:00
Sean McArthur
a5c60b24de Fix poll_capacity to wake in combination with max_send_buffer_size 2021-12-09 09:20:01 -08:00
Sean McArthur
88037ae0ab v0.3.8 2021-12-08 11:20:56 -08:00
Sean McArthur
efa113bac6 Add max send buffer per stream option (#580) 2021-12-08 10:03:15 -08:00
Anthony Ramine
e9e0f27b80 Add test that would make wait_for_capacity hang if it doesn't loop 2021-12-02 11:52:15 -08:00
Anthony Ramine
87969c1f29 Implement the extended CONNECT protocol from RFC 8441 (#565) 2021-11-24 10:05:10 +01:00
Sean McArthur
dbaa3a4285 fix: properly reject prioritized HEADERS with stream ID of zero 2021-11-23 10:32:45 -08:00
Sean McArthur
ce81583cf1 v0.3.7 2021-10-22 10:49:46 -07:00
Sean McArthur
405972739b Fix panic if remote causes local to reset a stream before opening 2021-10-22 09:47:30 -07:00
Anthony Ramine
f52d5e6290 Replace HTTP/2.0 by HTTP/2 😅
The protocol is named HTTP/2.
2021-10-20 11:10:25 -07:00
Anthony Ramine
c38c94cb16 Make :status in requests be a stream error 2021-10-19 11:02:44 -07:00
Sean McArthur
8520f06f93 v0.3.6 2021-09-30 12:18:30 -07:00
Sean McArthur
fc73fc987f fix: user created Error would not return provided Reason 2021-09-30 11:26:28 -07:00
Sean McArthur
44cb57c9d9 tests: add explicit SendResponse::send_reset test 2021-09-30 11:26:28 -07:00
Sean McArthur
953112944a v0.3.5 2021-09-29 13:40:13 -07:00
Anthony Ramine
508bcb1d27 Store buffered data size as usize (fixes #269) (#542) 2021-09-28 09:05:06 -07:00
Anthony Ramine
465f0337f8 Refactor errors internals (#556)
h2::Error now knows whether protocol errors happened because the user
sent them, because it was received from the remote peer, or because
the library itself emitted an error because it detected a protocol
violation.

It also keeps track of whether it came from a RST_STREAM or GO_AWAY
frame, and in the case of the latter, it includes the additional
debug data if any.

Fixes #530
2021-09-28 09:04:35 -07:00
David Korczynski
cab307d2ed fuzzing: fix build 2021-09-24 13:40:41 -07:00
Anthony Ramine
96d9277454 Remove code that was made obsolete by #555 2021-09-13 12:19:11 -07:00
Anthony Ramine
61b4f8fc34 Support very large headers
This completely refactors how headers are hpack-encoded.

Instead of trying to be clever, constructing frames on the go
while hpack-encoding, we just make a blob of all the
hpack-encoded headers first, and then we split that blob
in as many frames as necessary.
2021-09-08 10:20:30 -07:00
Alex Touchet
e9a13700cb Update version number in Readme (#549) 2021-09-08 09:44:22 +02:00
Sean McArthur
5072292320 v0.3.4 2021-08-20 15:47:50 -07:00