diff options
author | Rodrigo Kumpera <kumpera@users.noreply.github.com> | 2016-12-14 22:21:04 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-14 22:21:04 +0300 |
commit | 56f2ca1372c3e60d2f54807aba2ff8e5a621c00e (patch) | |
tree | d5761a83cbd791e94df54ceca15c7d1badba0e9a | |
parent | d3d120e1a4f642daa79df64f0aa58c19ec01e26a (diff) | |
parent | 3d548b9be3764c52d461e226dd40ae6a9e175716 (diff) |
Merge pull request #4123 from spouliot/tls-port-c8
[tls] Use host name without port for the Server Name Indication (SNI). Bug #46549.
-rw-r--r-- | mcs/class/System/Mono.Net.Security/MobileTlsContext.cs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/mcs/class/System/Mono.Net.Security/MobileTlsContext.cs b/mcs/class/System/Mono.Net.Security/MobileTlsContext.cs index 677a5107697..0cc6c51846a 100644 --- a/mcs/class/System/Mono.Net.Security/MobileTlsContext.cs +++ b/mcs/class/System/Mono.Net.Security/MobileTlsContext.cs @@ -35,6 +35,7 @@ namespace Mono.Net.Security MobileAuthenticatedStream parent; bool serverMode; string targetHost; + string serverName; SslProtocols enabledProtocols; X509Certificate serverCertificate; X509CertificateCollection clientCertificates; @@ -54,6 +55,13 @@ namespace Mono.Net.Security this.clientCertificates = clientCertificates; this.askForClientCert = askForClientCert; + serverName = targetHost; + if (!string.IsNullOrEmpty (serverName)) { + var pos = serverName.IndexOf (':'); + if (pos > 0) + serverName = serverName.Substring (0, pos); + } + certificateValidator = CertificateValidationHelper.GetDefaultValidator ( parent.Settings, parent.Provider); } @@ -92,6 +100,10 @@ namespace Mono.Net.Security get { return targetHost; } } + protected string ServerName { + get { return serverName; } + } + protected bool AskForClientCertificate { get { return askForClientCert; } } |