hyper: UnexpectedEof Error on HTTP/2 Requests with Rustls
Version
hyper = { version = "1.0.1", features = ["full"] }
tokio = { version = "1", features = ["full"] }
http-body-util = "0.1"
hyper-util = { version = "0.1.1", features = ["full"] }
tokio-rustls = "0.24.1"
rustls-pemfile = "1.0.4"
rustls = "0.21.9"
Platform
Darwin m1 23.0.0 Darwin Kernel Version 23.0.0: Fri Sep 15 14:41:34 PDT 2023; root:xnu-10002.1.13~1/RELEASE_ARM64_T8103 arm64
Description
When making successful HTTP/2 requests over TLS , the following server logs an UnexpectedEof error for each request:
tokio::task::spawn(async move {
if let Err(err) = hyper::server::conn::http2::Builder::new(
hyper_util::rt::tokio::TokioExecutor::new(),
)
.serve_connection(io, service_fn(hello))
.await
{
println!("Error serving connection: {:?}", err);
}
});
I tried this code:
https://gist.github.com/cablehead/e24990e364ecb3e6028d5978acd0c1c9
I performed a request using:
% curl -v -k --http2 https://localhost:3000
* Trying 127.0.0.1:3000...
* Connected to localhost (127.0.0.1) port 3000 (#0)
* ALPN: offers h2,http/1.1
* (304) (OUT), TLS handshake, Client hello (1):
* (304) (IN), TLS handshake, Server hello (2):
* (304) (IN), TLS handshake, Unknown (8):
* (304) (IN), TLS handshake, Certificate (11):
* (304) (IN), TLS handshake, CERT verify (15):
* (304) (IN), TLS handshake, Finished (20):
* (304) (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / AEAD-CHACHA20-POLY1305-SHA256
* ALPN: server accepted h2
* Server certificate:
* subject: CN=localhost
* start date: Nov 17 19:09:27 2023 GMT
* expire date: Nov 16 19:09:27 2024 GMT
* issuer: CN=localhost
* SSL certificate verify result: self signed certificate (18), continuing anyway.
* using HTTP/2
* h2 [:method: GET]
* h2 [:scheme: https]
* h2 [:authority: localhost:3000]
* h2 [:path: /]
* h2 [user-agent: curl/8.1.2]
* h2 [accept: */*]
* Using Stream ID: 1 (easy handle 0x132814200)
> GET / HTTP/2
> Host: localhost:3000
> User-Agent: curl/8.1.2
> Accept: */*
>
< HTTP/2 200
< date: Sun, 19 Nov 2023 17:36:02 GMT
< content-length: 13
<
* Connection #0 to host localhost left intact
Hello, World!%
This successfully returns “Hello world” from the server. However, the server prints out the following error on every successful request:
Error serving connection: hyper::Error(Io, Kind(UnexpectedEof))
Using the http1
builder with the same TLS wrapper does not exhibit this behavior, and neither does HTTP/2 without the TLS wrapper.
The expected behavior is that no error should be logged when a request completes successfully.
About this issue
- Original URL
- State: closed
- Created 7 months ago
- Comments: 16 (5 by maintainers)
Commits related to this issue
- Replace rustls with boring-ssl This removes all re-attempts present in monero-serai's RPC and is an attempt to narrow down the sporadic failures. Inspired by https://github.com/hyperium/hyper/issues... — committed to serai-dex/serai by kayabaNerve 7 months ago
- Replace rustls with boring-ssl This removes all re-attempts present in monero-serai's RPC and is an attempt to narrow down the sporadic failures. Inspired by https://github.com/hyperium/hyper/issues... — committed to serai-dex/serai by kayabaNerve 7 months ago
- Replace rustls with boring-ssl This removes all re-attempts present in monero-serai's RPC and is an attempt to narrow down the sporadic failures. Inspired by https://github.com/hyperium/hyper/issues... — committed to serai-dex/serai by kayabaNerve 7 months ago
- Replace rustls with boring-ssl This removes all re-attempts present in monero-serai's RPC and is an attempt to narrow down the sporadic failures. Inspired by https://github.com/hyperium/hyper/issues... — committed to serai-dex/serai by kayabaNerve 7 months ago
- Replace rustls with boring-ssl This removes all re-attempts present in monero-serai's RPC and is an attempt to narrow down the sporadic failures. Inspired by https://github.com/hyperium/hyper/issues... — committed to serai-dex/serai by kayabaNerve 7 months ago
It’d reasonable to assume the evidence points there. If after reporting there, new evidence says it’s in hyper, we can dig further over here!
Just to reiterate, it was noticed earlier in the thread that this seems to occur with hyper v0.14 as well (so I’ve adjusted the title).
Is this something new with rustls? Or with curl?