Compare commits

...

2 Commits

Author SHA1 Message Date
George MacKerron
bfb86b2e6e Briefer ALPN error message 2025-07-30 14:19:46 +01:00
George MacKerron
3bd2486778 Check postgresql ALPN value for direct SSL connections 2025-07-30 14:07:37 +01:00

View File

@@ -137,7 +137,13 @@ pub(crate) async fn handshake<S: AsyncRead + AsyncWrite + Unpin + Send>(
// check the ALPN, if exists, as required.
match conn_info.alpn_protocol() {
None | Some(PG_ALPN_PROTOCOL) => {}
None => {
if direct.is_some() {
warn!("missing ALPN");
return Err(HandshakeError::ProtocolViolation);
}
}
Some(PG_ALPN_PROTOCOL) => {}
Some(other) => {
let alpn = String::from_utf8_lossy(other);
warn!(%alpn, "unexpected ALPN");