From 174f6f7c51065a91946d070d94971eed87b57f22 Mon Sep 17 00:00:00 2001 From: LukePulverenti Luke Pulverenti luke pulverenti Date: Thu, 9 Aug 2012 08:42:59 -0400 Subject: [PATCH] Updated RequestContext to not force Response.SendChunked to true --- MediaBrowser.Common/Net/RequestContext.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/MediaBrowser.Common/Net/RequestContext.cs b/MediaBrowser.Common/Net/RequestContext.cs index c95f95ebac..544c54501c 100644 --- a/MediaBrowser.Common/Net/RequestContext.cs +++ b/MediaBrowser.Common/Net/RequestContext.cs @@ -2,6 +2,7 @@ using System.Linq; using System.Net; using MediaBrowser.Common.Net.Handlers; +using MediaBrowser.Common.Logging; namespace MediaBrowser.Common.Net { @@ -26,6 +27,9 @@ namespace MediaBrowser.Common.Net public void Respond(BaseHandler handler) { + Logger.LogInfo("Http Server received request at: " + Request.Url.ToString()); + Logger.LogInfo("Http Headers: " + string.Join(",", Request.Headers.AllKeys.Select(k => k + "=" + Request.Headers[k]))); + Response.AddHeader("Access-Control-Allow-Origin", "*"); Response.KeepAlive = true; @@ -56,9 +60,13 @@ namespace MediaBrowser.Common.Net Response.StatusCode = statusCode; - if (statusCode == 200) + if (statusCode == 200 || statusCode == 206) { - Response.SendChunked = handler.UseChunkedEncoding; + // 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) {