From fb51f1e6f012f0832e089b94a075b20089fed555 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 28 Feb 2014 00:22:36 -0500 Subject: refined app themes --- .../HttpServer/HttpResultFactory.cs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs') diff --git a/MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs b/MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs index 4c21d2eb7..8455d9f58 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs @@ -238,8 +238,19 @@ namespace MediaBrowser.Server.Implementations.HttpServer return hasOptions; } - // Otherwise wrap into an HttpResult - var httpResult = new HttpResult(result, contentType ?? "text/html", HttpStatusCode.NotModified); + IHasOptions httpResult; + + var stream = result as Stream; + + if (stream != null) + { + httpResult = new StreamWriter(stream, contentType, _logger); + } + else + { + // Otherwise wrap into an HttpResult + httpResult = new HttpResult(result, contentType ?? "text/html", HttpStatusCode.NotModified); + } AddResponseHeaders(httpResult, responseHeaders); @@ -478,7 +489,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer if (!SupportsCompression) { responseHeaders["Content-Length"] = originalContentLength.ToString(UsCulture); - + if (isHeadRequest) { return GetHttpResult(new byte[] { }, contentType); @@ -495,7 +506,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer { return GetHttpResult(new byte[] { }, contentType); } - + return new CompressedResult(contents, requestedCompressionType, contentType); } -- cgit v1.2.3