feat: rework TlsClientHelloBytesCallback as a connection middleware - #65808
Merged
DeagleGross merged 13 commits intoApr 10, 2026
Merged
Conversation
1 task
3 tasks
DeagleGross
force-pushed
the
dmkorolev/tls/tlsclienthellocallback-asconnectionmiddleware
branch
from
March 20, 2026 16:07
648e73d to
76e7405
Compare
TlsClientHelloBytesCallback as a connection middlewareTlsClientHelloBytesCallback as a connection middleware
DeagleGross
marked this pull request as ready for review
March 20, 2026 17:05
Contributor
There was a problem hiding this comment.
Pull request overview
This PR obsoletes HttpsConnectionAdapterOptions.TlsClientHelloBytesCallback and introduces a new ListenOptions connection middleware API (UseTlsClientHelloListener) to observe raw TLS ClientHello bytes in a way that also works with TlsHandshakeCallbackOptions scenarios.
Changes:
- Add
ListenOptionsHttpsExtensions.UseTlsClientHelloListener(...)as a connection middleware that sniffs ClientHello bytes beforeUseHttps(). - Mark
HttpsConnectionAdapterOptions.TlsClientHelloBytesCallbackas obsolete and keep back-compat support insideHttpsConnectionMiddleware. - Add functional tests and a sample usage demonstrating the new middleware API.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Servers/Kestrel/test/InMemory.FunctionalTests/TlsListenerTests.cs | Adds tests for new UseTlsClientHelloListener behavior and preserves back-compat tests for the obsolete option. |
| src/Servers/Kestrel/samples/SampleApp/Startup.cs | Demonstrates calling UseTlsClientHelloListener before UseHttps(). |
| src/Servers/Kestrel/Core/src/PublicAPI.Unshipped.txt | Declares the new public API surface for UseTlsClientHelloListener. |
| src/Servers/Kestrel/Core/src/Middleware/HttpsConnectionMiddleware.cs | Continues to support the obsolete TlsClientHelloBytesCallback path (pragma-suppressed). |
| src/Servers/Kestrel/Core/src/ListenOptionsHttpsExtensions.cs | Introduces the new connection middleware extension and its default timeout. |
| src/Servers/Kestrel/Core/src/HttpsConnectionAdapterOptions.cs | Obsoletes TlsClientHelloBytesCallback and updates docs to point to the new API. |
This was referenced Mar 20, 2026
Open
This was referenced Mar 25, 2026
Merged
This was referenced Mar 25, 2026
Merged
DeagleGross
enabled auto-merge (squash)
March 27, 2026 09:28
halter73
approved these changes
Apr 9, 2026
Member
|
You can just put the fixups for #65807 in this PR |
DeagleGross
disabled auto-merge
April 9, 2026 14:18
BrennanConroy
approved these changes
Apr 9, 2026
…ware' of https://github.com/DeagleGross/aspnetcore into dmkorolev/tls/tlsclienthellocallback-asconnectionmiddleware
DeagleGross
enabled auto-merge (squash)
April 10, 2026 09:29
DeagleGross
deleted the
dmkorolev/tls/tlsclienthellocallback-asconnectionmiddleware
branch
April 10, 2026 15:51
javiercn
pushed a commit
that referenced
this pull request
Apr 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Obsoleted
TlsClientHelloBytesCallbackonHttpsConnectionAdapterOptions, and reworked that as a connection middlewareFixes #64860