aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukePulverenti Luke Pulverenti luke pulverenti <LukePulverenti Luke Pulverenti luke.pulverenti@gmail.com>2012-08-06 18:10:07 -0400
committerLukePulverenti Luke Pulverenti luke pulverenti <LukePulverenti Luke Pulverenti luke.pulverenti@gmail.com>2012-08-06 18:10:07 -0400
commit442b9c559f6d6a2c14ed6624d4cdae186f4dcb3a (patch)
treea586d5c37ac88735b272c787c1af929d8c0a0acf
parentf9bdf0b6d93982197fdb9fafb655508066e9a002 (diff)
Made chunked encoding overridable
-rw-r--r--MediaBrowser.Common/Net/Handlers/BaseHandler.cs16
-rw-r--r--MediaBrowser.Common/Net/RequestContext.cs7
2 files changed, 22 insertions, 1 deletions
diff --git a/MediaBrowser.Common/Net/Handlers/BaseHandler.cs b/MediaBrowser.Common/Net/Handlers/BaseHandler.cs
index 16a08b9b3..a63759708 100644
--- a/MediaBrowser.Common/Net/Handlers/BaseHandler.cs
+++ b/MediaBrowser.Common/Net/Handlers/BaseHandler.cs
@@ -13,6 +13,22 @@ namespace MediaBrowser.Common.Net.Handlers
/// </summary>
public IDictionary<string, string> Headers = new Dictionary<string, string>();
+ public virtual bool UseChunkedEncoding
+ {
+ get
+ {
+ return true;
+ }
+ }
+
+ public virtual long? ContentLength
+ {
+ get
+ {
+ return null;
+ }
+ }
+
/// <summary>
/// Returns true or false indicating if the handler writes to the stream asynchronously.
/// If so the subclass will be responsible for disposing the stream when complete.
diff --git a/MediaBrowser.Common/Net/RequestContext.cs b/MediaBrowser.Common/Net/RequestContext.cs
index e00dac02a..c95f95eba 100644
--- a/MediaBrowser.Common/Net/RequestContext.cs
+++ b/MediaBrowser.Common/Net/RequestContext.cs
@@ -58,7 +58,12 @@ namespace MediaBrowser.Common.Net
if (statusCode == 200)
{
- Response.SendChunked = true;
+ Response.SendChunked = handler.UseChunkedEncoding;
+
+ if (handler.ContentLength.HasValue)
+ {
+ Response.ContentLength64 = handler.ContentLength.Value;
+ }
if (handler.CompressResponse)
{