diff options
| author | LukePulverenti Luke Pulverenti luke pulverenti <LukePulverenti Luke Pulverenti luke.pulverenti@gmail.com> | 2012-08-09 08:59:54 -0400 |
|---|---|---|
| committer | LukePulverenti Luke Pulverenti luke pulverenti <LukePulverenti Luke Pulverenti luke.pulverenti@gmail.com> | 2012-08-09 08:59:54 -0400 |
| commit | 027d1724e5cde936845e26c147a04e497a95b090 (patch) | |
| tree | f0d00c852539a43739294e9329008ec1198dd282 /MediaBrowser.Common/Net/RequestContext.cs | |
| parent | 174f6f7c51065a91946d070d94971eed87b57f22 (diff) | |
Added auto-detection of client-capabilities to determine whether to use gzip or deflate
Diffstat (limited to 'MediaBrowser.Common/Net/RequestContext.cs')
| -rw-r--r-- | MediaBrowser.Common/Net/RequestContext.cs | 31 |
1 files changed, 1 insertions, 30 deletions
diff --git a/MediaBrowser.Common/Net/RequestContext.cs b/MediaBrowser.Common/Net/RequestContext.cs index 544c54501..461f28601 100644 --- a/MediaBrowser.Common/Net/RequestContext.cs +++ b/MediaBrowser.Common/Net/RequestContext.cs @@ -1,8 +1,8 @@ using System;
using System.Linq;
using System.Net;
-using MediaBrowser.Common.Net.Handlers;
using MediaBrowser.Common.Logging;
+using MediaBrowser.Common.Net.Handlers;
namespace MediaBrowser.Common.Net
{
@@ -62,26 +62,6 @@ namespace MediaBrowser.Common.Net if (statusCode == 200 || statusCode == 206)
{
- // Don't force this to true. HttpListener will default it to true if supported by the client.
- if (!handler.UseChunkedEncoding)
- {
- Response.SendChunked = false;
- }
-
- if (handler.ContentLength.HasValue)
- {
- Response.ContentLength64 = handler.ContentLength.Value;
- }
-
- if (handler.CompressResponse)
- {
- Response.AddHeader("Content-Encoding", "deflate");
- }
-
- if (cacheDuration.Ticks > 0)
- {
- CacheResponse(Response, cacheDuration, handler.LastDateModified);
- }
handler.WriteStream(Response.OutputStream);
}
else
@@ -91,15 +71,6 @@ namespace MediaBrowser.Common.Net }
}
- private void CacheResponse(HttpListenerResponse response, TimeSpan duration, DateTime? dateModified)
- {
- DateTime lastModified = dateModified ?? DateTime.Now;
-
- response.Headers[HttpResponseHeader.CacheControl] = "public, max-age=" + Convert.ToInt32(duration.TotalSeconds);
- response.Headers[HttpResponseHeader.Expires] = DateTime.Now.Add(duration).ToString("r");
- response.Headers[HttpResponseHeader.LastModified] = lastModified.ToString("r");
- }
-
private bool IsCacheValid(DateTime ifModifiedSince, TimeSpan cacheDuration, DateTime? dateModified)
{
if (dateModified.HasValue)
|
