Reputation: 3945
I'm trying to secure my web application against timeouts of ajax requests. To do it, I obviously need to simulate such a timeout.
From what I've found here: http://kb.mozillazine.org/Network.http.connect.timeout#Background the firefox timeout is system-dependent and from what I've found here: http://support.microsoft.com/kb/181050 the IE timeout period is 60 minutes by default.
So I see the following ways to simulate a timeout:
All the ways above seem like an overkill to me. Does anyone know an easier way (possibly on a different browser)? Thanks!
Upvotes: 2
Views: 8933
Reputation: 27
It's simple, set the timeout to 10.
like this : xhr.timeout = 10;
Upvotes: 1
Reputation: 278
Wouldn't it be much easier to simply set the ajax timeout to 1 millisecond. Even on localhost it will always timeout at that value. This is the method I always use. The only thing you don't exercise with this approach is the actual "feel" that your preferred timeout period gives to the end user (ie, does 3 seconds feel long, is 2 seconds too short). But if you're just looking to exercise the code under the error response this does the trick for me.
Upvotes: 12
Reputation: 121
whats harm in setting KeepAliveTimeout in registry HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\InternetSettings ?
More information can be found here:
http://support.microsoft.com/kb/181050
Upvotes: 1
Reputation: 3945
Eventually the easiest way for me was simulate the timeout by setting ReceiveTimeout in registry HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings as described here:
http://support.microsoft.com/kb/181050
Darshan's solution might also work, but I just tested the above. Thank you all for help!
Upvotes: 1