Fiddlercore autoresponder issue

4 posts, 0 answers
  1. asia
    asia avatar
    4 posts
    Member since:
    Sep 2014

    Posted 02 Feb 2015 Link to this post

    I want to make a c# console application for intercepting the https connection to a server and return a local xml file as responcemy code is Fiddler.FiddlerApplication.BeforeRequest += delegate(Fiddler.Session oS)
    {
    if (oS.url.Contains("test.com"))
    {
    oS.bBufferResponse = true;
    oS.utilCreateResponseAndBypassServer();
    }
    };

    Fiddler.FiddlerApplication.BeforeResponse += delegate(Fiddler.Session oS)
    {
    oS.utilDecodeResponse();
    oS.LoadResponseFromFile("file.xml");
    };
    But it doesn't seem to work, I get connection error. Any ideas?
  2. Eric Lawrence
    Admin
    Eric Lawrence avatar
    833 posts

    Posted 02 Feb 2015 Link to this post

    You need to handle CONNECT tunnels specially.

    See http://fiddler.wikidot.com/fiddlercore-autorespond

    Regards,
    Eric Lawrence
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. asia
    asia avatar
    4 posts
    Member since:
    Sep 2014

    Posted 13 Feb 2015 in reply to Eric Lawrence Link to this post

    Thanks for the reply but i still dont get it.

    your link contains this, assuming i understand the first part how do i replace the return a session with return a specific file ? can you give me a code example ? cheers

    Fiddler.FiddlerApplication.BeforeRequest += delegate(Fiddler.Session oS)
    {
    if (oSession.HTTPMethodIs("CONNECT")) { oSession.oFlags["X-ReplyWithTunnel"] = "Fake for HTTPS Tunnel"; return; }
    if (oS.uriContains("replaceme.txt"))
    {
    oS.utilCreateResponseAndBypassServer();
    oS.responseBodyBytes = SessionIWantToReturn.responseBodyBytes;
    oS.oResponse.headers = (HTTPResponseHeaders) SessionIWantToReturn.oResponse.headers.Clone();
    }
    };







  4. Eric Lawrence
    Admin
    Eric Lawrence avatar
    833 posts

    Posted 13 Feb 2015 Link to this post

    There are several ways to achieve the task of returning a specific file. The simplest would be to set the oS.oFlags["x-replywithfile"] flag to the target filename.

    Alternatively, you could manually fill responseBodyBytes and the oResponse.headers based on whatever you want.


    Regards,
    Eric Lawrence
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top