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(request: &http::Request) -> (Option, Option) { 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 { connection .handshake_data()? .downcast::() .ok()? .server_name .and_then(|name| crate::config::request_host(&name).ok()) }