mirror of
https://github.com/n0-computer/noq.git
synced 2026-09-24 12:13:05 +00:00
Rely on rustls to check for ALPN failure
This commit is contained in:
committed by
Dirkjan Ochtman
parent
fea298d68e
commit
d9672322eb
@@ -23,7 +23,6 @@ use crate::{
|
||||
/// A rustls TLS session
|
||||
pub struct TlsSession {
|
||||
version: Version,
|
||||
using_alpn: bool,
|
||||
got_handshake_data: bool,
|
||||
next_secrets: Option<Secrets>,
|
||||
inner: Connection,
|
||||
@@ -100,14 +99,6 @@ impl crypto::Session for TlsSession {
|
||||
};
|
||||
if self.inner.alpn_protocol().is_some() || have_server_name || !self.is_handshaking() {
|
||||
self.got_handshake_data = true;
|
||||
if self.using_alpn && self.inner.alpn_protocol().is_none() {
|
||||
// rustls ignores total ALPN failure for compat, but QUIC gets a fresh start
|
||||
return Err(TransportError {
|
||||
code: TransportErrorCode::crypto(0x78),
|
||||
frame: None,
|
||||
reason: "ALPN negotiation failed".into(),
|
||||
});
|
||||
}
|
||||
return Ok(true);
|
||||
}
|
||||
}
|
||||
@@ -259,7 +250,6 @@ impl crypto::ClientConfig for rustls::ClientConfig {
|
||||
let version = interpret_version(version)?;
|
||||
Ok(Box::new(TlsSession {
|
||||
version,
|
||||
using_alpn: !self.alpn_protocols.is_empty(),
|
||||
got_handshake_data: false,
|
||||
next_secrets: None,
|
||||
inner: Connection::Client(
|
||||
@@ -286,7 +276,6 @@ impl crypto::ServerConfig for rustls::ServerConfig {
|
||||
let version = interpret_version(version).unwrap();
|
||||
Box::new(TlsSession {
|
||||
version,
|
||||
using_alpn: !self.alpn_protocols.is_empty(),
|
||||
got_handshake_data: false,
|
||||
next_secrets: None,
|
||||
inner: Connection::Server(
|
||||
|
||||
@@ -608,7 +608,7 @@ fn server_alpn_unset() {
|
||||
pair.drive();
|
||||
assert_matches!(
|
||||
pair.client_conn_mut(client_ch).poll(),
|
||||
Some(Event::ConnectionLost { reason: ConnectionError::TransportError(ref err) }) if err.code == TransportErrorCode::crypto(0x78)
|
||||
Some(Event::ConnectionLost { reason: ConnectionError::ConnectionClosed(err) }) if err.error_code == TransportErrorCode::crypto(0x78)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ futures-io = { version = "0.3.19", optional = true }
|
||||
futures-core = { version = "0.3.19", optional = true }
|
||||
rustc-hash = "1.1"
|
||||
proto = { package = "quinn-proto", path = "../quinn-proto", version = "0.8", default-features = false }
|
||||
rustls = { version = "0.20", default-features = false, features = ["quic"], optional = true }
|
||||
rustls = { version = "0.20.3", default-features = false, features = ["quic"], optional = true }
|
||||
thiserror = "1.0.21"
|
||||
tracing = "0.1.10"
|
||||
tokio = { version = "1.0.1", features = ["rt", "time", "sync"] }
|
||||
|
||||
Reference in New Issue
Block a user