diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-09-02 22:30:24 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-09-02 22:30:24 -0400 |
| commit | 60d1d5cdee642ee9d5be7e91be5caeb9a1a756df (patch) | |
| tree | 67dcd2270977afafc596a1c4568cdaa4cf9d26dc /MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs | |
| parent | a3d553a7fbe93fe416c940e80d5e511a2d753f25 (diff) | |
restore nuget targets for mono build
Diffstat (limited to 'MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs')
| -rw-r--r-- | MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs | 43 |
1 files changed, 9 insertions, 34 deletions
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; - } - } - /// <summary> /// Gets the optimized result. /// </summary> @@ -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); |
