diff options
Diffstat (limited to 'Emby.Server.Implementations/HttpServer/HttpListenerHost.cs')
| -rw-r--r-- | Emby.Server.Implementations/HttpServer/HttpListenerHost.cs | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs index 6b4f2bced..834ffb130 100644 --- a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs +++ b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs @@ -19,7 +19,6 @@ using MediaBrowser.Model.Events; using MediaBrowser.Model.Extensions; using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Services; -using MediaBrowser.Model.Text; using Microsoft.Extensions.Logging; namespace Emby.Server.Implementations.HttpServer @@ -37,11 +36,7 @@ namespace Emby.Server.Implementations.HttpServer private readonly IServerConfigurationManager _config; private readonly INetworkManager _networkManager; - private readonly IServerApplicationHost _appHost; - - private readonly ITextEncoding _textEncoding; - private readonly IJsonSerializer _jsonSerializer; private readonly IXmlSerializer _xmlSerializer; private readonly Func<Type, Func<string, object>> _funcParseFn; @@ -56,21 +51,19 @@ namespace Emby.Server.Implementations.HttpServer public HttpListenerHost( IServerApplicationHost applicationHost, - ILogger logger, + ILoggerFactory loggerFactory, IServerConfigurationManager config, string defaultRedirectPath, INetworkManager networkManager, - ITextEncoding textEncoding, IJsonSerializer jsonSerializer, IXmlSerializer xmlSerializer, Func<Type, Func<string, object>> funcParseFn) { _appHost = applicationHost; - _logger = logger; + _logger = loggerFactory.CreateLogger("HttpServer"); _config = config; DefaultRedirectPath = defaultRedirectPath; _networkManager = networkManager; - _textEncoding = textEncoding; _jsonSerializer = jsonSerializer; _xmlSerializer = xmlSerializer; _funcParseFn = funcParseFn; @@ -116,8 +109,7 @@ namespace Emby.Server.Implementations.HttpServer public Type GetServiceTypeByRequest(Type requestType) { - Type serviceType; - ServiceOperationsMap.TryGetValue(requestType, out serviceType); + ServiceOperationsMap.TryGetValue(requestType, out var serviceType); return serviceType; } @@ -148,7 +140,7 @@ namespace Emby.Server.Implementations.HttpServer return; } - var connection = new WebSocketConnection(e.WebSocket, e.Endpoint, _jsonSerializer, _logger, _textEncoding) + var connection = new WebSocketConnection(e.WebSocket, e.Endpoint, _jsonSerializer, _logger) { OnReceive = ProcessWebSocketMessageReceived, Url = e.Url, @@ -199,13 +191,13 @@ namespace Emby.Server.Implementations.HttpServer { switch (ex) { - case ArgumentException _: return 400; - case SecurityException _: return 401; + case ArgumentException _: return 400; + case SecurityException _: return 401; case DirectoryNotFoundException _: case FileNotFoundException _: - case ResourceNotFoundException _: return 404; + case ResourceNotFoundException _: return 404; case RemoteServiceUnavailableException _: return 502; - default: return 500; + default: return 500; } } @@ -673,8 +665,7 @@ namespace Emby.Server.Implementations.HttpServer return null; } - string contentType; - var restPath = ServiceHandler.FindMatchingRestPath(httpReq.HttpMethod, pathInfo, out contentType); + var restPath = ServiceHandler.FindMatchingRestPath(httpReq.HttpMethod, pathInfo, out string contentType); if (restPath != null) { |
