The Free Software Media System - Server Backend & API
Set response length and mime type correctly when reporting an error
Vasily33b69a709997
diff --git a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs b/Emby.Server.Implementations/HttpServer/HttpListenerHost.csindex d60f5c0556..5b1a079302 100644--- a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs+++ b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs@@ -233,8 +233,10 @@ namespace Emby.Server.Implementations.HttpServervar statusCode = GetStatusCode(ex);httpRes.StatusCode = statusCode;- httpRes.ContentType = "text/html";- await httpRes.WriteAsync(NormalizeExceptionMessage(ex.Message)).ConfigureAwait(false);+ var errContent = NormalizeExceptionMessage(ex.Message);+ httpRes.ContentType = "text/plain";+ httpRes.ContentLength = errContent.Length;+ await httpRes.WriteAsync(errContent).ConfigureAwait(false);}catch (Exception errorEx){