diff --git a/quinn-proto/src/crypto/rustls.rs b/quinn-proto/src/crypto/rustls.rs index 8c4eb3e8e..ab176dca7 100644 --- a/quinn-proto/src/crypto/rustls.rs +++ b/quinn-proto/src/crypto/rustls.rs @@ -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, 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( diff --git a/quinn-proto/src/tests/mod.rs b/quinn-proto/src/tests/mod.rs index 2c34eef3f..c7ccc0ca6 100644 --- a/quinn-proto/src/tests/mod.rs +++ b/quinn-proto/src/tests/mod.rs @@ -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) ); } diff --git a/quinn/Cargo.toml b/quinn/Cargo.toml index 32c7ea89d..d07514b35 100644 --- a/quinn/Cargo.toml +++ b/quinn/Cargo.toml @@ -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"] }