I would like to add a uniform delay to responses in all sessions that Fiddler intercepts. The use of "response-trickle-delay"
is unacceptable, since that doesn't actually introduce a uniform delay, but rather delays each 1KB of transfer (which simulates low bandwidth, rather than high latency).
The only reference I could find was here, which used the following atrocity (DO NOT USE!):
static function wait(msecs)
{
var start = new Date().getTime();
var cur = start;
while(cur – start < msecs)
{
cur = new Date().getTime();
}
}
and wait(5000);
is inserted into OnBeforeResponse
.
As expected, it locked up my computer and started overheating my CPU and I had to quit Fiddler.
I'm looking for something:
It looks like FiddlerScript is written in JScript.NET, and from what I gather there is a setTimeout()
function, but I'm having trouble calling it (and I don't know JavaScript or .NET at all). Here is my OnBeforeResponse
:
static function OnBeforeResponse(oSession: Session) {
if (m_Hide304s && oSession.responseCode == 304) {
oSession["ui-hide"] = "true";
}
setTimeout(function(){},1000);
}
It just gives a syntax error at the setTimeout
line. Can setTimeout()
be used from a FiddlerScript to introduce uniform delay?
FiddlerScript uses JScript.NET, which can reference .NET assemblies, and System.Threading
contains Sleep
.
System.Threading.dll
. On my machine, this was located at C:\Windows\Microsoft.NET\Framework\v4.0.30319
.import System.Threading;
.Thread.Sleep(1000)
.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With