aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/HttpServer
diff options
context:
space:
mode:
authorLuke <luke.pulverenti@gmail.com>2016-11-10 17:42:53 -0500
committerGitHub <noreply@github.com>2016-11-10 17:42:53 -0500
commit3fb6a10e893f68485887896e1d9fc8b780bbb5a2 (patch)
tree517305f73f5f973cccc8ba4be1e9f443777a411e /MediaBrowser.Server.Implementations/HttpServer
parentf909a3f153465966a5a35a71ba9159c36b36fd58 (diff)
parent2c64cc7d7d2471f52a7ce1dbd909564215504974 (diff)
Merge pull request #2280 from MediaBrowser/dev
Dev
Diffstat (limited to 'MediaBrowser.Server.Implementations/HttpServer')
-rw-r--r--MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs22
1 files changed, 15 insertions, 7 deletions
diff --git a/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs b/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs
index d86e4da37..643d0c956 100644
--- a/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs
+++ b/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs
@@ -196,17 +196,25 @@ namespace MediaBrowser.Server.Implementations.HttpServer
return new WebSocketSharpListener(_logger, cert, _memoryStreamProvider, _textEncoding, _networkManager, _socketFactory, _cryptoProvider, new StreamFactory(), enableDualMode, GetRequest);
}
- public static ICertificate GetCert(string certificateLocation)
+ public ICertificate GetCert(string certificateLocation)
{
- X509Certificate2 localCert = new X509Certificate2(certificateLocation);
- //localCert.PrivateKey = PrivateKey.CreateFromFile(pvk_file).RSA;
- if (localCert.PrivateKey == null)
+ try
+ {
+ X509Certificate2 localCert = new X509Certificate2(certificateLocation);
+ //localCert.PrivateKey = PrivateKey.CreateFromFile(pvk_file).RSA;
+ if (localCert.PrivateKey == null)
+ {
+ //throw new FileNotFoundException("Secure requested, no private key included", certificateLocation);
+ return null;
+ }
+
+ return new Certificate(localCert);
+ }
+ catch (Exception ex)
{
- //throw new FileNotFoundException("Secure requested, no private key included", certificateLocation);
+ Logger.ErrorException("Error loading cert from {0}", ex, certificateLocation);
return null;
}
-
- return new Certificate(localCert);
}
private IHttpRequest GetRequest(HttpListenerContext httpContext)