[System]: Fix bug #52508 in HttpListener when doing multiple Https request.
authorMartin Baulig <mabaul@microsoft.com>
Wed, 26 Apr 2017 22:30:17 +0000 (18:30 -0400)
committerMartin Baulig <mabaul@microsoft.com>
Wed, 26 Apr 2017 22:54:27 +0000 (18:54 -0400)
Move the call to SslStream.AuthenticateAsServer() into the constructor because
we don't want to call it again when Init() is called from Close().

mcs/class/System/System.Net/HttpConnection.cs

index 680ec8188ede53fa1566e771c2eae315be289c84..bd465b9ca29004dce302b117a3ca292d87d6cc53 100644 (file)
@@ -97,6 +97,8 @@ namespace System.Net {
                                stream = ssl_stream;
                        }
                        timer = new Timer (OnTimeout, null, Timeout.Infinite, Timeout.Infinite);
+                       if (ssl_stream != null)
+                               ssl_stream.AuthenticateAsServer (cert, true, (SslProtocols)ServicePointManager.SecurityProtocol, false);
                        Init ();
                }
 
@@ -114,10 +116,6 @@ namespace System.Net {
 
                void Init ()
                {
-                       if (ssl_stream != null) {
-                               ssl_stream.AuthenticateAsServer (cert, true, (SslProtocols)ServicePointManager.SecurityProtocol, false);
-                       }
-
                        context_bound = false;
                        i_stream = null;
                        o_stream = null;