Skip to content

Commit 9540908

Browse files
committed
Improve logging
1 parent 7cff8c5 commit 9540908

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

src/http_version.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,25 @@ impl HttpVersion {
2121
pub fn from_negotiated_protocol_server<IO>(tls: &tokio_rustls::server::TlsStream<IO>) -> Self {
2222
let (_io, conn) = tls.get_ref();
2323

24-
let chosen_protocol = Self::from_alpn_bytes(conn.alpn_protocol());
25-
tracing::debug!("[server] Chosen protocol {chosen_protocol:?}",);
24+
let negotiated_alpn = conn.alpn_protocol();
25+
let chosen_protocol = Self::from_alpn_bytes(negotiated_alpn);
26+
tracing::debug!(
27+
"[server] Negotiated ALPN {:?}, chosen protocol {chosen_protocol:?}",
28+
negotiated_alpn.map(String::from_utf8_lossy)
29+
);
2630
chosen_protocol
2731
}
2832

2933
/// Given a client TLS stream, choose an HTTP version to use
3034
pub fn from_negotiated_protocol_client<IO>(tls: &tokio_rustls::client::TlsStream<IO>) -> Self {
3135
let (_io, conn) = tls.get_ref();
3236

33-
let chosen_protocol = Self::from_alpn_bytes(conn.alpn_protocol());
34-
tracing::debug!("[client] Chosen protocol {chosen_protocol:?}",);
37+
let negotiated_alpn = conn.alpn_protocol();
38+
let chosen_protocol = Self::from_alpn_bytes(negotiated_alpn);
39+
tracing::debug!(
40+
"[client] Negotiated ALPN {:?}, chosen protocol {chosen_protocol:?}",
41+
negotiated_alpn.map(String::from_utf8_lossy)
42+
);
3543
chosen_protocol
3644
}
3745

0 commit comments

Comments
 (0)