aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/HttpServer/StreamWriter.cs
diff options
context:
space:
mode:
authorLogicalPhallacy <44458166+LogicalPhallacy@users.noreply.github.com>2019-08-06 00:26:19 -0700
committerGitHub <noreply@github.com>2019-08-06 00:26:19 -0700
commit984e415c66cbd995d12ea95a3a9d3e2561ce4869 (patch)
tree1799942f3836641786c0e29249801bdb46aac0f4 /Emby.Server.Implementations/HttpServer/StreamWriter.cs
parentc2667f99f4d50f4f7d9bbeec50e8491e52468962 (diff)
parent89f592687ee7ae7f0e0fffd884dbf2890476410a (diff)
Merge pull request #5 from jellyfin/master
Merge up to latest master
Diffstat (limited to 'Emby.Server.Implementations/HttpServer/StreamWriter.cs')
-rw-r--r--Emby.Server.Implementations/HttpServer/StreamWriter.cs12
1 files changed, 9 insertions, 3 deletions
diff --git a/Emby.Server.Implementations/HttpServer/StreamWriter.cs b/Emby.Server.Implementations/HttpServer/StreamWriter.cs
index cf30bbc32..194d04441 100644
--- a/Emby.Server.Implementations/HttpServer/StreamWriter.cs
+++ b/Emby.Server.Implementations/HttpServer/StreamWriter.cs
@@ -14,8 +14,6 @@ namespace Emby.Server.Implementations.HttpServer
/// </summary>
public class StreamWriter : IAsyncStreamWriter, IHasHeaders
{
- private static readonly CultureInfo UsCulture = new CultureInfo("en-US");
-
/// <summary>
/// Gets or sets the source stream.
/// </summary>
@@ -52,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;
}
@@ -60,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))
{
@@ -69,6 +74,7 @@ namespace Emby.Server.Implementations.HttpServer
SourceBytes = source;
+ Headers[HeaderNames.ContentLength] = contentLength.ToString(CultureInfo.InvariantCulture);
Headers[HeaderNames.ContentType] = contentType;
}