From ab7e697f309f7cc8badb76f27443656e2def2728 Mon Sep 17 00:00:00 2001 From: dkanada Date: Sun, 22 Sep 2019 18:36:41 +0900 Subject: [PATCH 1/2] add mediabrowser route back for now --- .../HttpServer/HttpListenerHost.cs | 28 +++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs index bdcf5d0b7c..11df2bab14 100644 --- a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs +++ b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs @@ -94,7 +94,7 @@ namespace Emby.Server.Implementations.HttpServer /// public void ApplyRequestFilters(IRequest req, HttpResponse res, object requestDto) { - //Exec all RequestFilter attributes with Priority < 0 + // Exec all RequestFilter attributes with Priority < 0 var attributes = GetRequestFilterAttributes(requestDto.GetType()); int count = attributes.Count; @@ -105,7 +105,7 @@ namespace Emby.Server.Implementations.HttpServer attribute.RequestFilter(req, res, requestDto); } - //Exec remaining RequestFilter attributes with Priority >= 0 + // Exec remaining RequestFilter attributes with Priority >= 0 for (; i < count && attributes[i].Priority >= 0; i++) { var attribute = attributes[i]; @@ -278,7 +278,7 @@ namespace Emby.Server.Implementations.HttpServer } catch { - + _logger.LogWarning("Error disposing connection"); } } } @@ -603,7 +603,14 @@ namespace Emby.Server.Implementations.HttpServer Summary = route.Summary }); - routes.Add(new RouteAttribute(NormalizeOldRoutePath(route.Path), route.Verbs) + routes.Add(new RouteAttribute(NormalizeEmbyRoutePath(route.Path), route.Verbs) + { + Notes = route.Notes, + Priority = route.Priority, + Summary = route.Summary + }); + + routes.Add(new RouteAttribute(NormalizeMediaBrowserRoutePath(route.Path), route.Verbs) { Notes = route.Notes, Priority = route.Priority, @@ -645,7 +652,7 @@ namespace Emby.Server.Implementations.HttpServer } // this method was left for compatibility with third party clients - private static string NormalizeOldRoutePath(string path) + private static string NormalizeEmbyRoutePath(string path) { if (path.StartsWith("/", StringComparison.OrdinalIgnoreCase)) { @@ -655,6 +662,17 @@ namespace Emby.Server.Implementations.HttpServer return "emby/" + path; } + // this method was left for compatibility with third party clients + private static string NormalizeMediaBrowserRoutePath(string path) + { + if (path.StartsWith("/", StringComparison.OrdinalIgnoreCase)) + { + return "/mediabrowser" + path; + } + + return "mediabrowser/" + path; + } + private static string NormalizeCustomRoutePath(string baseUrl, string path) { if (path.StartsWith("/", StringComparison.OrdinalIgnoreCase)) From b5b7db1f324a834cf2fce0bad4c7bb4cf7da5c29 Mon Sep 17 00:00:00 2001 From: dkanada Date: Tue, 24 Sep 2019 23:20:37 +0900 Subject: [PATCH 2/2] add an exception to logging --- Emby.Server.Implementations/HttpServer/HttpListenerHost.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs index 11df2bab14..d60f5c0556 100644 --- a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs +++ b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs @@ -276,9 +276,9 @@ namespace Emby.Server.Implementations.HttpServer { connection.Dispose(); } - catch + catch (Exception ex) { - _logger.LogWarning("Error disposing connection"); + _logger.LogError(ex, "Error disposing connection"); } } }