diff options
| author | LukePulverenti Luke Pulverenti luke pulverenti <LukePulverenti Luke Pulverenti luke.pulverenti@gmail.com> | 2012-08-06 18:10:07 -0400 |
|---|---|---|
| committer | LukePulverenti Luke Pulverenti luke pulverenti <LukePulverenti Luke Pulverenti luke.pulverenti@gmail.com> | 2012-08-06 18:10:07 -0400 |
| commit | 442b9c559f6d6a2c14ed6624d4cdae186f4dcb3a (patch) | |
| tree | a586d5c37ac88735b272c787c1af929d8c0a0acf | |
| parent | f9bdf0b6d93982197fdb9fafb655508066e9a002 (diff) | |
Made chunked encoding overridable
| -rw-r--r-- | MediaBrowser.Common/Net/Handlers/BaseHandler.cs | 16 | ||||
| -rw-r--r-- | MediaBrowser.Common/Net/RequestContext.cs | 7 |
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)
{
|
