-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Fix Mono bug #52508 in HttpListener when doing multiple Https request. #19487
Conversation
Move the call to SslStream.AuthenticateAsServer() into the constructor because we don't want to call it again when Init() is called from Close().
Where are the new tests to validate this change? This code is not just used on Mono so it needs to be generally applicable. |
It's an old bug that has been in Mono's version for ages, before CoreFx was based on that codebase. It just recently came up when a customer filed a bug report with a rather complicated project, but I was able to track it down to making multiple requests on the same connection. Adding tests - while surely desirable - would be a little bit complicated because it requires HttpListener with SSL, which is currently not supported in CoreFx on non-Windows platforms due to this FIXME: |
@@ -103,6 +103,9 @@ public HttpConnection(Socket sock, HttpEndPointListener epl, bool secure, X509Ce | |||
} | |||
|
|||
_timer = new Timer(OnTimeout, null, Timeout.Infinite, Timeout.Infinite); | |||
if (_sslStream != null) { | |||
_sslStream.AuthenticateAsServer (_cert, true, (SslProtocols)ServicePointManager.SecurityProtocol, false); |
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.
nit: formatting, allman braces, no spaces after function name..
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.
Does .Net Framework's HttpListener use ServicePointManager.SecurityProtocol?
Maybe it would be better to postpone this and add it as a dependent task to #14691 to ensure we're not regressing anything? |
@@ -103,6 +103,9 @@ public HttpConnection(Socket sock, HttpEndPointListener epl, bool secure, X509Ce | |||
} | |||
|
|||
_timer = new Timer(OnTimeout, null, Timeout.Infinite, Timeout.Infinite); | |||
if (_sslStream != null) { | |||
_sslStream.AuthenticateAsServer (_cert, true, (SslProtocols)ServicePointManager.SecurityProtocol, false); |
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.
Nit: this can now be:
_sslStream?.AuthenticateAsServer(_cert, true, (SslProtocols)ServicePointManager.SecurityProtocol, false);
@CIPop we'd prefer merging this now instead of waiting for #14691 so we can move forward integrating the code in Mono :) |
Move the call to SslStream.AuthenticateAsServer() into the constructor because
we don't want to call it again when Init() is called from Close().