mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-21 09:34:44 +01:00
Merge branch 'dev' of https://github.com/MediaBrowser/MediaBrowser into dev
This commit is contained in:
@@ -44,6 +44,8 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
||||
|
||||
private readonly bool _supportsNativeWebSocket;
|
||||
|
||||
private string _certificatePath;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the local end points.
|
||||
/// </summary>
|
||||
@@ -217,10 +219,12 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
||||
{
|
||||
if (_supportsNativeWebSocket && NativeWebSocket.IsSupported)
|
||||
{
|
||||
// Certificate location is ignored here. You need to use netsh
|
||||
// to assign the certificate to the proper port.
|
||||
return new HttpListenerServer(_logger, OnRequestReceived);
|
||||
}
|
||||
|
||||
return new WebSocketSharpListener(_logger, OnRequestReceived);
|
||||
return new WebSocketSharpListener(_logger, OnRequestReceived, _certificatePath);
|
||||
}
|
||||
|
||||
private void WebSocketHandler(WebSocketConnectEventArgs args)
|
||||
@@ -425,8 +429,9 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
public void StartServer(IEnumerable<string> urlPrefixes)
|
||||
public void StartServer(IEnumerable<string> urlPrefixes, string certificatePath)
|
||||
{
|
||||
_certificatePath = certificatePath;
|
||||
UrlPrefixes = urlPrefixes.ToList();
|
||||
Start(UrlPrefixes.First());
|
||||
}
|
||||
|
||||
@@ -18,11 +18,14 @@ namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp
|
||||
|
||||
private readonly ILogger _logger;
|
||||
private readonly Action<string> _endpointListener;
|
||||
private readonly string _certificatePath ;
|
||||
|
||||
public WebSocketSharpListener(ILogger logger, Action<string> endpointListener)
|
||||
public WebSocketSharpListener(ILogger logger, Action<string> endpointListener,
|
||||
string certificatePath)
|
||||
{
|
||||
_logger = logger;
|
||||
_endpointListener = endpointListener;
|
||||
_certificatePath = certificatePath;
|
||||
}
|
||||
|
||||
public Action<Exception, IRequest> ErrorHandler { get; set; }
|
||||
@@ -34,7 +37,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp
|
||||
public void Start(IEnumerable<string> urlPrefixes)
|
||||
{
|
||||
if (_listener == null)
|
||||
_listener = new HttpListener(new PatternsLogger(_logger), null);
|
||||
_listener = new HttpListener(new PatternsLogger(_logger), _certificatePath);
|
||||
|
||||
foreach (var prefix in urlPrefixes)
|
||||
{
|
||||
|
||||
@@ -508,6 +508,14 @@
|
||||
"LabelLocalHttpServerPortNumberHelp": "The tcp port number that Media Browser's http server should bind to.",
|
||||
"LabelPublicPort": "Public port number:",
|
||||
"LabelPublicPortHelp": "The public port number that should be mapped to the local port.",
|
||||
|
||||
"LabelUseHttps": "Enable SSL",
|
||||
"LabelUseHttpsHelp": "Check to enable SSL hosting.",
|
||||
"LabelHttpsPort": "Local http port:",
|
||||
"LabelHttpsPortHelp": "The tcp port number that Media Browser's https server should bind to.",
|
||||
"LabelCertificatePath": "SSL Certificate path:",
|
||||
"LabelCertificatePathHelp": "The path on the filesystem to the ssl certificate pfx file.",
|
||||
|
||||
"LabelWebSocketPortNumber": "Web socket port number:",
|
||||
"LabelEnableAutomaticPortMap": "Enable automatic port mapping",
|
||||
"LabelEnableAutomaticPortMapHelp": "Attempt to automatically map the public port to the local port via UPnP. This may not work with some router models.",
|
||||
|
||||
@@ -99,22 +99,22 @@ namespace MediaBrowser.Server.Implementations.ServerManager
|
||||
/// <summary>
|
||||
/// Starts this instance.
|
||||
/// </summary>
|
||||
public void Start(IEnumerable<string> urlPrefixes)
|
||||
public void Start(IEnumerable<string> urlPrefixes, string certificatePath)
|
||||
{
|
||||
ReloadHttpServer(urlPrefixes);
|
||||
ReloadHttpServer(urlPrefixes, certificatePath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restarts the Http Server, or starts it if not currently running
|
||||
/// </summary>
|
||||
private void ReloadHttpServer(IEnumerable<string> urlPrefixes)
|
||||
private void ReloadHttpServer(IEnumerable<string> urlPrefixes, string certificatePath)
|
||||
{
|
||||
_logger.Info("Loading Http Server");
|
||||
|
||||
try
|
||||
{
|
||||
HttpServer = _applicationHost.Resolve<IHttpServer>();
|
||||
HttpServer.StartServer(urlPrefixes);
|
||||
HttpServer.StartServer(urlPrefixes, certificatePath);
|
||||
}
|
||||
catch (SocketException ex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user