This is a migrated thread and some comments may be shown as answers.

oSession.requestBodyBytes is sending 0 bytes

9 Answers 537 Views
Windows
This is a migrated thread and some comments may be shown as answers.
Deva
Top achievements
Rank 1
Deva asked on 13 Dec 2019, 07:55 AM

I am trying to redirect a request as is. The request initially hits server1 and using Fiddler I want to redirect the exact same request to another server (the whole request and body). I am able to successfully resend the request to server2, how ever I see that the request body is coming as 0 bytes (so the application errors out on server2 as expected).

 I basically take all the sessions and filter out and select sessions that have ***.action in their url, by doing this

static function sessionSelector(ss: String):Session{
    var arrSess: Session[] = FiddlerApplication.UI.g.GetAllSessions();

    for (var i:int = 0; i<arrSess.Length; i++)
    {
          var sess: Session = arrSess[i];            
          if(sess.url.Contains(ss)){
return sess;
}
}
return;
}

9 Answers, 1 is accepted

Sort by
0
Deva
Top achievements
Rank 1
answered on 13 Dec 2019, 08:00 AM

I hit "post" too soon on the previous post. I am reproducing my previous post and completing it

I am trying to redirect a request as is. The request initially hits server1 and using Fiddler I want to redirect the exact same request to another server (the whole request and body). I am able to successfully resend the request to server2, how ever I see that the request body is coming as 0 bytes (so the application errors out on server2 as expected).
 I basically take all the sessions and filter out and select sessions that have ***.action in their url, by doing this

static function sessionSelector(ss: String):Session{
    var arrSess: Session[] = FiddlerApplication.UI.g.GetAllSessions();

    for (var i:int = 0; i<arrSess.Length; i++)
    {
          var sess: Session = arrSess[i];            
          if(sess.url.Contains(ss)){
               return sess;
          }
    }
    return;
}

 

Then for the session that is filtered, I then change the url by doing the below

selectedSession.fullUrl = 'http://myserver:8082/appLoc' + selectedSession.PathAndQuery;

 

Then use the below syntax to do the resend of the request

FiddlerApplication.oProxy.SendRequest(selectedSession.oRequest.headers, selectedSession.requestBodyBytes, null);

 

in this line I see that "selectedSession.requestBodyBytes" is of 0 bytes when I see it on the fiddler UI too and also on server2.

Can someone tell me what am I missing.

 

0
Eric R | Senior Technical Support Engineer
Telerik team
answered on 17 Dec 2019, 10:19 PM

Hi Deva,

Thank you for providing the code snippet. Although, I noticed the thread is under FiddlerCore and in the code snippet it references the Fiddler UI. Can you let me know which product you are using? This will help in troubleshooting the issue.

Additionally, the FiddlerApplication Class has specific events for processing sessions. Can you also let me know where this event is firing?

In the meantime, please let me know if you need any additional information. Thank you and I look forward to your reply.

Regards,


Eric R | Technical Support Engineer
Progress Telerik

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Deva
Top achievements
Rank 1
answered on 18 Dec 2019, 04:40 AM

Eric - to be frank, I am a little confused whether I am using core or UI. But it does look like I am using the UI.

The fiddler functionality is invoked by calling the below line from the cmd line

ExecAction "testingredirect myServer:8181/neoweb/neo doLogin"

 

Then in the fiddler script I added the below case syntax in the "OnExecAction" function

case "testingredirect":
                var selectedSession: Session = sessionSelector(sParams[2]);
                var oBodyString: Byte[]  = selectedSession.requestBodyBytes;            
                selectedSession.fullUrl = 'http://myserver:8082/appLoc' + selectedSession.PathAndQuery;
                FiddlerObject.StatusText="Replacing [" + gs_ReplaceToken + "] in URIs with [" + gs_ReplaceTokenWith + "]";
                FiddlerApplication.oProxy.SendRequest(selectedSession.oRequest.headers, selectedSession.requestBodyBytes, null);
                return true; 

 

The function sessionSeelector code is below

static function sessionSelector(ss: String):Session{
        var arrSess: Session[] = FiddlerApplication.UI.GetAllSessions();
        for (var i:int = 0; i<arrSess.Length; i++)
        {
               var sess: Session = arrSess[i];            
               if(sess.url.Contains(ss)){
                  return sess;
               }
        }
return;
}

0
Eric R | Senior Technical Support Engineer
Telerik team
answered on 19 Dec 2019, 05:59 PM

Hi Deva,

Thank you for providing the additional information. This does appear to be using Fiddler Desktop and not Fiddler Core. I have updated the thread information accordingly. In order to fully troubleshoot this I will need additional information which is listed below. 

Note: I was unable to replicate the issue locally due to the below error. Debug information will be provided if Fiddler is opened or if executing this from the QuickExec box will also provide debug information. 

1. Can you open Fiddler and try running the testingredirect function from the command line and from the QuickExec?

2. It also appears that a session will need to be selected in the Fiddler Session pane. Can you confirm that a session is selected as well? If the session is selected, can you provide a Session Archive

3. Can you also provide an output of the Fiddler Log tab after running the above tests?

4. Any other screenshots or logs that you may find useful.

Once I have the above information I will be able to provide more information.

For additional reference, the AutoResponder may be a better choice for what you're trying to achieve. See the documentation for more details.

In the meantime, please let me know if you have any additional questions. Thank you and I look forward to your reply. 

Regards,


Eric R | Technical Support Engineer
Progress Telerik

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Deva
Top achievements
Rank 1
answered on 20 Dec 2019, 09:11 AM

Eric

 executing the QuickExec from the commandline works in the sense that the redirect happens correctly, except that the requestbody is 0 bytes in size. In the attached screen shot, you will see that the redirection happens alright from deva:8080 to deva:8082 and the URLs are also different. The only issue is that the size of the original request was 24772 bytes but the redirected request is 1038 bytes.

 

I got the error that you have posted, but that was because the end point URL was down, once I resolved that I was able to get the screenshot that I have attached

Yes, we need a session. So I programatically generate a call (basically use a headless browser script (phantom js) and then run the testingredirect to perform the redirect. I think this is working as seen from the UI in the attached screen shot. So yes, I generate a session and then select it too. Iam unable to attach the .saz file as the forum does not allow it, is there a different way that I can get it to you.

 

I am not getting any info in the fiddler log tab. I cleared the log tab and reran my test and did not see anything being written to the log

My initial thoughts are that the AutoResponder may not work for me as the redirect happens at a random time post the initial request. So the sequence is

1. Make the call ((I have no control over this URL, so cannot add or edit the call or the system)

2. Do some processing , then at a random point determine you now need to perform the redirect

3. Generate a new call (I have no control over this URL, so cannot add or edit the call or the system)

4. Use the call from step3 to perform the redirect. If i could distinguish and let AutoResponder know when to kick in, then I can use it.

 

0
Eric R | Senior Technical Support Engineer
Telerik team
answered on 20 Dec 2019, 01:46 PM

Hi Deva,

Thank you for the additional information. Actually, from the screenshot, it looks like we're making progress. Although, the reason the redirect request size is smaller is because Apache returned a 404 which is generally just an error page. I recommend ensuring the redirect site on port 8082 works without using Fiddler. This can be accomplished by using a regular browser and navigating to the URL. 

Can you confirm the redirect site works without Fiddler? 

Please let me know if you need any additional information. Thank you and I look forward to your reply.

Regards,


Eric R | Technical Support Engineer
Progress Telerik

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Deva
Top achievements
Rank 1
answered on 23 Dec 2019, 07:01 AM

Eric

  Yes, the redirect site works. To give you some more details, I have a working code base (which include the errors you noticed above) this is my main site. I copy and paste the same code base and this is my redirect site (the main site runs from within eclipse and my redirect site a stand alone tomcat server). So effectively there is no difference between my main site and my redirect site. 

 

I could provide a side by view of the UI for both the sites, but there isnt any difference. 

If the error is what is causing the size of the request to be different, I would have expected the main site request to also be same size. Another bit of detail is, that I am basically looking to pass the login info to my redirect site, so on my main site it does correctly tell me that the uid/pwd are invalid. In my redirect site when I debug it says uid is null. This is the issue I am looking to address

Thanks

Deva

0
Eric R | Senior Technical Support Engineer
Telerik team
answered on 23 Dec 2019, 01:32 PM

Hi Deva,

Thank you for the information. Although, I believe there was a misunderstanding. From the screenshot, the redirect is working but the response from the redirect to deva:8082/ocwen/T001/doLogin.action is a 404 which means the resource isn't available in the Server. This is why the Highlighted Body values are different. I believe that if the redirect is routed to /T001/doLogin.action it may work as expected. I recommend changing the redirect route to /T001/doLogin.action

Ultimately, this appears to be working as expected now and I am not sure there is an existing issue. If the issue persists after the above changes, please let me know.

As always, let me know if you need any additional information. Thank you.

Regards,


Eric R | Technical Support Engineer
Progress Telerik

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Deva
Top achievements
Rank 1
answered on 24 Dec 2019, 04:12 AM

Eric

My bad, you are right, the server was not configured correctly and hence the issue. Once you pointed it out, i reset everything (just so I can tell you that I checked and it is still broken). But I was wrong, and once I configured the server correctly, it now works fine. That would mean that the size of the body that you see on the fiddler UI is the size of the response body and not the request body I guess (that is where i got confused) - but i do know that the redirect was sending a blank userid. Let me see if that is still the case.

 

Thanks, I think the issue is resolve for now.

Deva

Tags
Windows
Asked by
Deva
Top achievements
Rank 1
Answers by
Deva
Top achievements
Rank 1
Eric R | Senior Technical Support Engineer
Telerik team
Share this question
or