diff options
| author | Bond-009 <bond.009@outlook.com> | 2019-03-07 21:08:57 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-03-07 21:08:57 +0100 |
| commit | 10a0d6bdba821449abfb1d48e9708ba6f3fc6a62 (patch) | |
| tree | 602be322daedca127ba66de07837ac8e792730a7 /Emby.Server.Implementations/HttpServer/StreamWriter.cs | |
| parent | ae0ecc1b10982d9240ecdcc82cb7299fc708aafb (diff) | |
| parent | 0abe57e930e44eab9566991f33b089d1e61cfb83 (diff) | |
Merge pull request #1010 from cvium/kestrel_poc
Remove System.Net and port to Kestrel
Diffstat (limited to 'Emby.Server.Implementations/HttpServer/StreamWriter.cs')
| -rw-r--r-- | Emby.Server.Implementations/HttpServer/StreamWriter.cs | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/Emby.Server.Implementations/HttpServer/StreamWriter.cs b/Emby.Server.Implementations/HttpServer/StreamWriter.cs index cb2e3580b..66a13e20d 100644 --- a/Emby.Server.Implementations/HttpServer/StreamWriter.cs +++ b/Emby.Server.Implementations/HttpServer/StreamWriter.cs @@ -6,6 +6,7 @@ using System.Threading; using System.Threading.Tasks; using MediaBrowser.Model.Services; using Microsoft.Extensions.Logging; +using Microsoft.Net.Http.Headers; namespace Emby.Server.Implementations.HttpServer { @@ -52,12 +53,7 @@ namespace Emby.Server.Implementations.HttpServer SourceStream = source; - Headers["Content-Type"] = contentType; - - if (source.CanSeek) - { - Headers["Content-Length"] = source.Length.ToString(UsCulture); - } + Headers[HeaderNames.ContentType] = contentType; } /// <summary> @@ -65,8 +61,7 @@ namespace Emby.Server.Implementations.HttpServer /// </summary> /// <param name="source">The source.</param> /// <param name="contentType">Type of the content.</param> - /// <param name="logger">The logger.</param> - public StreamWriter(byte[] source, string contentType, int contentLength) + public StreamWriter(byte[] source, string contentType) { if (string.IsNullOrEmpty(contentType)) { @@ -75,9 +70,7 @@ namespace Emby.Server.Implementations.HttpServer SourceBytes = source; - Headers["Content-Type"] = contentType; - - Headers["Content-Length"] = contentLength.ToString(UsCulture); + Headers[HeaderNames.ContentType] = contentType; } public async Task WriteToAsync(Stream responseStream, CancellationToken cancellationToken) |
