Search code examples
fiddler

Is it possible to disconnect a client mid-request?


I'm trying to simulate the situation where a client is sending a large POST request to the server and the server (or a load balancer) terminates the client connection halfway through the request. Is this possible to do with Fiddler? I'm open to other (Windows) tool suggestions as well.

Thanks!


Solution

  • Click Rules > Customize Rules. Scroll to the OnPeekAtRequestHeaders function. Add code like so:

    static function OnPeekAtRequestHeaders(oSession: Session) {
    
        if (oSession.uriContains("myupload.php") && 
            oSession.oRequest.headers.Exists("Content-Length") && 
            oSession.oRequest.headers["Content-Length"] != "0")
        {
            oSession.oRequest.pipeClient.EndWithRST();
        }
    }