aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/HttpServer/StreamWriter.cs
diff options
context:
space:
mode:
authorBond-009 <bond.009@outlook.com>2019-04-25 07:27:37 +0200
committerGitHub <noreply@github.com>2019-04-25 07:27:37 +0200
commit61d7bed18145cd8b56b748a87b9398fb75332044 (patch)
treeb48499b493aaec6ffdc538c297f865e5259e5063 /Emby.Server.Implementations/HttpServer/StreamWriter.cs
parenta0e61ee67f56a6f2735c3f3e8f97e3da794c0c1a (diff)
parent28c2ac528d46ba97b920d37300fa814bd6f4a51a (diff)
Merge pull request #1304 from jellyfin/release-10.3.z
Backmerge 10.3.1
Diffstat (limited to 'Emby.Server.Implementations/HttpServer/StreamWriter.cs')
-rw-r--r--Emby.Server.Implementations/HttpServer/StreamWriter.cs11
1 files changed, 10 insertions, 1 deletions
diff --git a/Emby.Server.Implementations/HttpServer/StreamWriter.cs b/Emby.Server.Implementations/HttpServer/StreamWriter.cs
index 324f9085e..194d04441 100644
--- a/Emby.Server.Implementations/HttpServer/StreamWriter.cs
+++ b/Emby.Server.Implementations/HttpServer/StreamWriter.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Globalization;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
@@ -49,6 +50,13 @@ namespace Emby.Server.Implementations.HttpServer
SourceStream = source;
+ Headers["Content-Type"] = contentType;
+
+ if (source.CanSeek)
+ {
+ Headers[HeaderNames.ContentLength] = source.Length.ToString(CultureInfo.InvariantCulture);
+ }
+
Headers[HeaderNames.ContentType] = contentType;
}
@@ -57,7 +65,7 @@ namespace Emby.Server.Implementations.HttpServer
/// </summary>
/// <param name="source">The source.</param>
/// <param name="contentType">Type of the content.</param>
- public StreamWriter(byte[] source, string contentType)
+ public StreamWriter(byte[] source, string contentType, int contentLength)
{
if (string.IsNullOrEmpty(contentType))
{
@@ -66,6 +74,7 @@ namespace Emby.Server.Implementations.HttpServer
SourceBytes = source;
+ Headers[HeaderNames.ContentLength] = contentLength.ToString(CultureInfo.InvariantCulture);
Headers[HeaderNames.ContentType] = contentType;
}