From 60d1d5cdee642ee9d5be7e91be5caeb9a1a756df Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 2 Sep 2014 22:30:24 -0400 Subject: restore nuget targets for mono build --- .../HttpServer/HttpResultFactory.cs | 43 +++++----------------- 1 file changed, 9 insertions(+), 34 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 9997cfbdb..e13e27d5a 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs @@ -102,14 +102,6 @@ namespace MediaBrowser.Server.Implementations.HttpServer return result; } - private bool SupportsCompression - { - get - { - return true; - } - } - /// /// Gets the optimized result. /// @@ -127,7 +119,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer throw new ArgumentNullException("result"); } - var optimizedResult = SupportsCompression ? requestContext.ToOptimizedResult(result) : result; + var optimizedResult = requestContext.ToOptimizedResult(result); if (responseHeaders != null) { @@ -471,7 +463,9 @@ namespace MediaBrowser.Server.Implementations.HttpServer { Throttle = options.Throttle, ThrottleLimit = options.ThrottleLimit, - MinThrottlePosition = options.MinThrottlePosition + MinThrottlePosition = options.MinThrottlePosition, + ThrottleCallback = options.ThrottleCallback, + OnComplete = options.OnComplete }; } @@ -488,39 +482,20 @@ namespace MediaBrowser.Server.Implementations.HttpServer { Throttle = options.Throttle, ThrottleLimit = options.ThrottleLimit, - MinThrottlePosition = options.MinThrottlePosition + MinThrottlePosition = options.MinThrottlePosition, + ThrottleCallback = options.ThrottleCallback, + OnComplete = options.OnComplete }; } string content; - long originalContentLength = 0; using (var stream = await factoryFn().ConfigureAwait(false)) { - using (var memoryStream = new MemoryStream()) - { - await stream.CopyToAsync(memoryStream).ConfigureAwait(false); - memoryStream.Position = 0; - - originalContentLength = memoryStream.Length; - - using (var reader = new StreamReader(memoryStream)) - { - content = await reader.ReadToEndAsync().ConfigureAwait(false); - } - } - } - - if (!SupportsCompression) - { - responseHeaders["Content-Length"] = originalContentLength.ToString(UsCulture); - - if (isHeadRequest) + using (var reader = new StreamReader(stream)) { - return GetHttpResult(new byte[] { }, contentType); + content = await reader.ReadToEndAsync().ConfigureAwait(false); } - - return new HttpResult(content, contentType); } var contents = content.Compress(requestedCompressionType); -- cgit v1.2.3