-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Use handshake timeout for Tls listener callback #62177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use handshake timeout for Tls listener callback #62177
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
@@ -21,7 +21,7 @@ | |||
|
|||
namespace InMemory.FunctionalTests; | |||
|
|||
public class TlsListenerMiddlewareTests : TestApplicationErrorLoggerLoggedTest | |||
public class TlsListenerTests : TestApplicationErrorLoggerLoggedTest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can probably add a cancellation test here as well. Set the handshake timeout to something small like 1 millisecond and check that the request was canceled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
Problem
HttpsConnectionMiddleware carefully considers a handshake timeout.
New TlsListenerMiddleware does not use it, and in case of a configured timeout request will not be cancelled.
Solution
I renamed
TlsListenerMiddleware
toTlsListener
to be used as part ofHttpsConnectionMiddleware
. It will use the same cancellation token as the latter. We can move the code directly intoHttpsConnectionMiddleware
but IMOTlsListener
has a bit different purpose and can be living in a separate instance.TlsListener
now does not invoke next middleware delegate.Also changed the parsing code to remember the TLS client hello record length, and if that is known re-parsing of TLS client hello "header" will not be happening on each iteration.
Closes #62172