timeout in session after reuest send to server

1 Answer 462 Views
Fiddler Classic
farshad
Top achievements
Rank 1
Iron
farshad asked on 18 Apr 2022, 09:22 AM
i want to timeout and retry a session that's already send out to server but server is under heavy load and can't response in a reasonable time so i want to retry the request if the server didn't respond in xx second after the request is send is that possible with fiddler?

1 Answer, 1 is accepted

Sort by
0
Nick Iliev
Telerik team
answered on 18 Apr 2022, 01:01 PM

Hi Farshad,

 

Check this SO thread for suggestions on how to simulate timeout with Fiddler Classic

You can retry a session from the UI or through FiddlerScript.

Regards,
Nick Iliev
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

farshad
Top achievements
Rank 1
Iron
commented on 18 Apr 2022, 06:48 PM

hi

this is not what i want. this create a delay in the response or request i want to request goes as normal but if server not responded for example in 10 second then i abort or abandon that request issue another one or maybe generate my own response and pass that to client

Nick Iliev
Telerik team
commented on 19 Apr 2022, 05:16 AM | edited

You can use the Session timers to measure the time between different events https://docs.telerik.com/fiddlercore/api/fiddler.sessiontimers

Additionally, you can check this thread for suggestions on how to reissue requests every N-minutes: https://groups.google.com/g/httpfiddler/c/8r9Hop7LMXg

 

 
farshad
Top achievements
Rank 1
Iron
commented on 19 Apr 2022, 07:06 AM

i try your suggestion but i have a problem

        if (oSession.uriContains("https://mywebservice20.c/"))
            {
        
            FiddlerApplication.Log.LogString(oSession.Timers.ClientDoneRequest);
            var oTimer: System.Windows.Forms.Timer = new Timer();   
            oTimer.add_Tick(OnTimer);  
            oTimer.Interval = 5000;
            oTimer.Start();
            }

    public static function OnTimer(sender: Object, ea: EventArgs)
    {
        FiddlerApplication.Log.LogString('55');
       
        try{
            MessageBox.Show("send failed" )
            //sender.utilCreateResponseAndBypassServer();
            //sender.oResponse.headers.Add("Access-Control-Allow-Origin", "*") ;
            //sender.oResponse.headers.Add("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, HEAD, OPTIONS");
            //sender.oResponse.headers.HTTPResponseCode = 200;
            //sender.oResponse.headers.HTTPResponseStatus = "200 OK";
            //oTimer.stop();
        }
        catch(e){
            MessageBox.Show("send failed" + e.ToString());
        }
    } 

first problem i open https://mywebservice20.c and the timer wont run at all.

second problem i want to pass Osession and oTimer to Ontimer function so i can stop the timer and set the response and send that to client but i keep getting type mismatch. 

Nick Iliev
Telerik team
commented on 19 Apr 2022, 10:51 AM

The contains checks for URL that ends with forward-slash (https://mywebservice20.c/ vs https://mywebservice20.c) and it would be expected that there won't be a match.

For the type mismatch, ensure that you are using the proper language in FiddlerScript (the options being JScript.NET vs. C# from Options > Tools > Scripting) and respecting the declared variables' scope and functions.

farshad
Top achievements
Rank 1
Iron
commented on 19 Apr 2022, 11:05 AM

the matching is not a problem it get matched and the log shows that the first part gets matched but the function OnTimer never runs after that.

about type missmatch i put

  oTimer.add_Tick(oSession,oTimer); 

and

public static function OnTimer(sender,oTimer)

 

but it wont compile.

Tags
Fiddler Classic
Asked by
farshad
Top achievements
Rank 1
Iron
Answers by
Nick Iliev
Telerik team
Share this question
or