Reputation: 3338
It is possible to run a script on prerequest
and preresponse
in Fiddler script. I want to automatically abort requests that contain a string in the URL.
In the Fiddler GUI it is possible to abort the request by right clicking the request and then clicking abort but I want to do this automatically.
In Fiddler script in the onbeforerequet
method I have added
if (oSession.uriContains("string")) {
//abort request
}
This is true when my string is contained in the URL. How can I abort the request?
Upvotes: 2
Views: 3137
Reputation: 13
if (bWantToDropConnection){
oSession.oRequest.pipeClient.End();
oSession.utilCreateResponseAndBypassServer();
oSession.oResponse.headers.HTTPResponseCode = 0;
oSession.oResponse.headers.HTTPResponseStatus = "0 Client Connection Dropped by script";
oSession.state = SessionStates.Aborted;
return;
}
Credits go to EricLaw (https://groups.google.com/forum/#!topic/httpfiddler/Bf-DUuXbqfg)
Upvotes: 1
Reputation: 7411
oSession.oRequest.FailSession(404, "Blocked", "Fiddler blocked request");
Should do the deal.
Upvotes: 7