Skip to content

feat: expose the negotiated TLS version via TlsInfo - #3067

Merged
seanmonstar merged 1 commit into
seanmonstar:masterfrom
dennisameling:tls-info-negotiated-version
Jul 13, 2026
Merged

feat: expose the negotiated TLS version via TlsInfo#3067
seanmonstar merged 1 commit into
seanmonstar:masterfrom
dennisameling:tls-info-negotiated-version

Conversation

@dennisameling

Copy link
Copy Markdown
Contributor

Closes #3066

TlsInfo already carried the peer certificate and was already gated behind ClientBuilder::tls_info(true), but the negotiated protocol version -- which the rustls backend has in hand at the point TlsInfo is built -- was never surfaced. Response::version() answers "which HTTP version?"; there was no equivalent for TLS.

Add a version field to TlsInfo with a version() accessor, and populate it in the rustls TlsInfoFactory impls from CommonState::protocol_version(), translated through the existing Version::from_rustls.

native-tls exposes no accessor for the negotiated version, so it reports None -- the same "Some where the backend can report it, None otherwise" contract peer_certificate() already has.

Non-breaking: TlsInfo's fields are pub(crate), so downstream code can neither construct it with a struct literal nor match it exhaustively.

`TlsInfo` already carried the peer certificate and was already gated
behind `ClientBuilder::tls_info(true)`, but the negotiated protocol
version -- which the rustls backend has in hand at the point `TlsInfo`
is built -- was never surfaced. `Response::version()` answers "which
HTTP version?"; there was no equivalent for TLS.

Add a `version` field to `TlsInfo` with a `version()` accessor, and
populate it in the rustls `TlsInfoFactory` impls from
`CommonState::protocol_version()`, translated through the existing
`Version::from_rustls`.

native-tls exposes no accessor for the negotiated version, so it reports
`None` -- the same "`Some` where the backend can report it, `None`
otherwise" contract `peer_certificate()` already has.

Non-breaking: `TlsInfo`'s fields are `pub(crate)`, so downstream code can
neither construct it with a struct literal nor match it exhaustively.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rpgnpy35JSnyLi9uHZ96hc

@seanmonstar seanmonstar left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@seanmonstar
seanmonstar merged commit fc99bd5 into seanmonstar:master Jul 13, 2026
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose the negotiated TLS version via TlsInfo

2 participants