diff options
| author | Vasily <just.one.man@yandex.ru> | 2019-10-09 13:54:05 +0300 |
|---|---|---|
| committer | Vasily <just.one.man@yandex.ru> | 2019-10-09 13:54:05 +0300 |
| commit | 33b69a709997924aa2cf8ce06a46939d7243001b (patch) | |
| tree | 88cd83ec50adef6ad39e77b27a18fbc27fad1f9f /Emby.Server.Implementations/HttpServer/HttpListenerHost.cs | |
| parent | 531642fc534870cb351c04fd4a8e6f8c60673ecc (diff) | |
Set response length and mime type correctly when reporting an error
Diffstat (limited to 'Emby.Server.Implementations/HttpServer/HttpListenerHost.cs')
| -rw-r--r-- | Emby.Server.Implementations/HttpServer/HttpListenerHost.cs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs index d60f5c055..5b1a07930 100644 --- a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs +++ b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs @@ -233,8 +233,10 @@ namespace Emby.Server.Implementations.HttpServer var 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) { |
