This project is read-only.
4
Vote

BufferOutput

description

IIS caches responce.
It's not good for big files.
I propose to make a little change in ResumingActionResultBase.cs.
 
private void WriteBinaryData(ControllerContext context, Stream fileContent, long startIndex, long endIndex)
{
  var response = context.HttpContext.Response;
  response.BufferOutput = false;  // <---- add this
  // ....
  long bytesRemaining = totalToSend + 1; //To make EndIndex inclusive
  response.AppendHeader("Content-Length", bytesRemaining.ToString()); // <---- and this

comments

VikingErik wrote Apr 20, 2012 at 6:04 PM

When I examined the HTTP output it seemed the Content-Length was automatically being filled in by IIS. I didn't manage this directly so IIS could take care of it. Is this not the desired action? As for BufferOutput - I suppose I could add this. I'm concerned what this will do if I alter the default behavior. Should this be configurable instead? I'm honestly asking - I don't know what the best default is here. I see your point and at the very least it should be an option if not the default.

wrote Apr 20, 2012 at 6:06 PM

wrote Apr 20, 2012 at 6:21 PM

wrote Feb 14, 2013 at 2:05 AM

jhedens wrote Mar 8, 2014 at 10:23 AM

I would suggest to indeed override the default behaviour in this so you will prevent memoryOverflows with large files.

I vote up

wrote Mar 8, 2014 at 10:23 AM

VikingErik wrote Mar 10, 2014 at 5:56 AM

I added the suggested changes, committed to CodePlex, made a new NuGet package and published to the NuGet package repo. I had to download the MVC 2 redistribution since this was created way back in the day when that was the latest hotness. It's a release build and should be signed. I didn't have time to test it out in a demo project but I'll try to swing around to that soon just to make sure I didn't just publish something horribly broken.

wrote Jul 28, 2014 at 3:34 AM

wrote Nov 28 at 3:15 PM