aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/HttpServer
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Server.Implementations/HttpServer')
-rw-r--r--MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs16
-rw-r--r--MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs8
2 files changed, 12 insertions, 12 deletions
diff --git a/MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs b/MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs
index 2419320a5..9359261c5 100644
--- a/MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs
+++ b/MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs
@@ -360,19 +360,11 @@ namespace MediaBrowser.Server.Implementations.HttpServer
var compress = ShouldCompressResponse(requestContext, contentType);
- var hasOptions = GetStaticResult(requestContext, responseHeaders, contentType, factoryFn, compress, isHeadRequest);
+ var hasOptions = GetStaticResult(requestContext, responseHeaders, contentType, factoryFn, compress, isHeadRequest).Result;
- return GetStaticResultTask(hasOptions, responseHeaders);
- }
-
- private async Task<object> GetStaticResultTask(Task<IHasOptions> optionsTask,
- IEnumerable<KeyValuePair<string, string>> responseHeaders)
- {
- var options = await optionsTask.ConfigureAwait(false);
-
- AddResponseHeaders(options, responseHeaders);
+ AddResponseHeaders(hasOptions, responseHeaders);
- return options;
+ return hasOptions;
}
/// <summary>
@@ -670,4 +662,4 @@ namespace MediaBrowser.Server.Implementations.HttpServer
throw error;
}
}
-}
+} \ No newline at end of file
diff --git a/MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs b/MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs
index a4e6f18bb..a8774f1b7 100644
--- a/MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs
+++ b/MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs
@@ -2,6 +2,7 @@
using ServiceStack.Web;
using System;
using System.Collections.Generic;
+using System.Globalization;
using System.IO;
using System.Threading.Tasks;
@@ -13,6 +14,8 @@ namespace MediaBrowser.Server.Implementations.HttpServer
public class StreamWriter : IStreamWriter, IHasOptions
{
private ILogger Logger { get; set; }
+
+ private static readonly CultureInfo UsCulture = new CultureInfo("en-US");
/// <summary>
/// Gets or sets the source stream.
@@ -50,6 +53,11 @@ namespace MediaBrowser.Server.Implementations.HttpServer
Logger = logger;
Options["Content-Type"] = contentType;
+
+ if (source.CanSeek)
+ {
+ Options["Content-Length"] = source.Length.ToString(UsCulture);
+ }
}
/// <summary>