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/FileWriter.cs | |
| parent | 318e0d4a2449baff806afb4ee22dc0f4021ca180 (diff) | |
Switch to HeaderNames instead of hardcoded strings (and other header related fixes)
Diffstat (limited to 'Emby.Server.Implementations/HttpServer/FileWriter.cs')
| -rw-r--r-- | Emby.Server.Implementations/HttpServer/FileWriter.cs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Emby.Server.Implementations/HttpServer/FileWriter.cs b/Emby.Server.Implementations/HttpServer/FileWriter.cs index 1375089e3..303db9980 100644 --- a/Emby.Server.Implementations/HttpServer/FileWriter.cs +++ b/Emby.Server.Implementations/HttpServer/FileWriter.cs @@ -9,6 +9,7 @@ using Emby.Server.Implementations.IO; using MediaBrowser.Model.IO; using MediaBrowser.Model.Services; using Microsoft.Extensions.Logging; +using Microsoft.Net.Http.Headers; namespace Emby.Server.Implementations.HttpServer { @@ -56,10 +57,10 @@ namespace Emby.Server.Implementations.HttpServer FileSystem = fileSystem; RangeHeader = rangeHeader; - Headers["Content-Type"] = contentType; + Headers[HeaderNames.ContentType] = contentType; TotalContentLength = fileSystem.GetFileInfo(path).Length; - Headers["Accept-Ranges"] = "bytes"; + Headers[HeaderNames.AcceptRanges] = "bytes"; if (string.IsNullOrWhiteSpace(rangeHeader)) { @@ -97,8 +98,8 @@ namespace Emby.Server.Implementations.HttpServer // Content-Length is the length of what we're serving, not the original content var lengthString = RangeLength.ToString(UsCulture); - var rangeString = string.Format("bytes {0}-{1}/{2}", RangeStart, RangeEnd, TotalContentLength); - Headers["Content-Range"] = rangeString; + var rangeString = $"bytes {RangeStart}-{RangeEnd}/{TotalContentLength}"; + Headers[HeaderNames.ContentRange] = rangeString; Logger.LogInformation("Setting range response values for {0}. RangeRequest: {1} Content-Length: {2}, Content-Range: {3}", Path, RangeHeader, lengthString, rangeString); } |
