Question

So I have an application that is caching local files with some code like this:

Fiddler.FiddlerApplication.BeforeRequest += delegate(Fiddler.Session oS)
{
    if (oS.url.StartsWith("foo.com/"))
    {
        oS.utilCreateResponseAndBypassServer();
        oS.oFlags["x-replywithfile"] = Path.GetFullPath(oS.url.Replace("foo.com/", "serve/"));
    }
}

This works fine for any files < 2GB. Above 2GB I get the error:

Fiddler - The requested file could not be read. The file is too long. This operation is currently limited to supporting files less than 2 gigabytes in size.   

I'm assuming internally Fiddler is using something like File.ReadAllBytes which is limited to 2gb because of maximum size of int. As far as I can tell there's no source code for FiddlerCore to open it up and change this... anyone know how to work around this limitation?

Was it helpful?

Solution

Cool scenario.

Yes, unfortunately the .NET Framework inherently limits all objects to a 2GB size, and as a consequence earlier versions of the AutoResponder could not return responses over 2gb. Update: Fiddler version 2.4.9.4 and later automatically detect huge files; any X-ReplyWithFile body over 262 megabytes (fiddler.memory.DropIfOver preference) will be streamed from the client and not stored in memory.

You could use Fiddler to return a HTTP/307 redirect to a different webserver and host the huge file there.

Your event handler could also directly stream the bytes of the file to the client in chunks (without using the x-replywithfile feature) using the oSession.oRequest.pipeClient.Send method, but this would involve a significant amount of code.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top