diff options
| author | Claus Vium <clausvium@gmail.com> | 2019-03-05 19:20:28 +0100 |
|---|---|---|
| committer | Claus Vium <clausvium@gmail.com> | 2019-03-05 19:20:28 +0100 |
| commit | 78742b8e4c658b1f02c9c040b8abb8ee5742bed4 (patch) | |
| tree | 6ee8afb5b09e9ee85de83fbe231786b9759a9837 /Emby.Server.Implementations/HttpServer/ResponseFilter.cs | |
| parent | 318e0d4a2449baff806afb4ee22dc0f4021ca180 (diff) | |
Switch to HeaderNames instead of hardcoded strings (and other header related fixes)
Diffstat (limited to 'Emby.Server.Implementations/HttpServer/ResponseFilter.cs')
| -rw-r--r-- | Emby.Server.Implementations/HttpServer/ResponseFilter.cs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Emby.Server.Implementations/HttpServer/ResponseFilter.cs b/Emby.Server.Implementations/HttpServer/ResponseFilter.cs index ae6a6576e..a53d9bf0b 100644 --- a/Emby.Server.Implementations/HttpServer/ResponseFilter.cs +++ b/Emby.Server.Implementations/HttpServer/ResponseFilter.cs @@ -3,6 +3,7 @@ using System.Globalization; using System.Text; using MediaBrowser.Model.Services; using Microsoft.Extensions.Logging; +using Microsoft.Net.Http.Headers; namespace Emby.Server.Implementations.HttpServer { @@ -44,13 +45,13 @@ namespace Emby.Server.Implementations.HttpServer if (dto is IHasHeaders hasHeaders) { - if (!hasHeaders.Headers.ContainsKey("Server")) + if (!hasHeaders.Headers.ContainsKey(HeaderNames.Server)) { - hasHeaders.Headers["Server"] = "Microsoft-NetCore/2.0, UPnP/1.0 DLNADOC/1.50"; + hasHeaders.Headers[HeaderNames.Server] = "Microsoft-NetCore/2.0, UPnP/1.0 DLNADOC/1.50"; } // Content length has to be explicitly set on on HttpListenerResponse or it won't be happy - if (hasHeaders.Headers.TryGetValue("Content-Length", out string contentLength) + if (hasHeaders.Headers.TryGetValue(HeaderNames.ContentLength, out string contentLength) && !string.IsNullOrEmpty(contentLength)) { var length = long.Parse(contentLength, UsCulture); |
