This commit is contained in:
Mateusz Gruszczyński committed 2026-10-11 22:12:27 +02:00
1 parent 75104f87ba
commit 4cc994b3bc
86 files changed
+942 -223

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
/// A client can cancel an obsolete in-flight request during navigation/F5.
/// RFC 9114 section 4.1.1 gives this a stream reset code, not an HTTP 400.
/// Treat only peer-originated cancellation as benign; local protocol errors
/// and other remote reset codes remain visible to operators.
fn client_cancelled_code(code: Code) -> bool {
code == Code::H3_REQUEST_CANCELLED || code == Code::H3_NO_ERROR
}
fn client_cancelled_request(error: &h3::error::StreamError) -> bool {
matches!(
error,
h3::error::StreamError::RemoteTerminate { code, .. } if client_cancelled_code(*code)
)
}
fn request_identity<B>(request: &http::Request<B>) -> (Option<String>, Option<String>) {
let authority = request
.uri()
.authority()
.map(|value| value.as_str().to_owned());
let host = request
.headers()
.get(http::header::HOST)
.and_then(|value| value.to_str().ok())
.map(str::to_owned);
(authority, host)
}
fn connection_sni(connection: &quinn::Connection) -> Option<String> {
connection
.handshake_data()?
.downcast::<quinn::crypto::rustls::HandshakeData>()
.ok()?
.server_name
.and_then(|name| crate::config::request_host(&name).ok())
}