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

not buffered autotamper responce

4 Answers 20 Views
FiddlerCore
This is a migrated thread and some comments may be shown as answers.
Bedi
Top achievements
Rank 1
Bedi asked on 29 Jul 2019, 12:33 PM
is it possible transmit not buffered responce when request created by utilCreateResponseAndBypassServer?

code:

on_before_request(Session oSession)
{
    if(oSession.fullUrl=='http../123')
    {
    oSession.utilCreateResponseAndBypassServer();
    oSession.bBufferResponse=false;
    my_curl_downloader(oSession.fullUrl,
    /*on headers line availible*/delegate(byte[] buf, int size, int nmemb, Object extraData)
    {
    var header_str=Encoding.UTF8.GetString(buf);
    //oSession.oResponse.headers.AssignFromString(header_str);

    var header=header_str.split(':');
    oSession.oResponse.headers.Add(header[0],header[1]);
    },
    /*on data availible*/delegate(byte[] buf, int size, int nmemb, Object extraData)
    {
    oSession.state=SessionStates.ReadingResponse;//?????????????
    oSession.responseBodyBytes.append??(buf); //?????????
    })
}
}

4 Answers, 1 is accepted

Sort by
0
Bedi
Top achievements
Rank 1
answered on 29 Jul 2019, 01:09 PM

got empty responce

 

on_before_request(Session oSession)
{
    if(oSession.fullUrl=='http../123')
    {
                            oSession.utilCreateResponseAndBypassServer();
                            oSession.bBufferResponse = false;
                            oSession.state = SessionStates.ReadingResponse;
                            
                            new Thread(() =>
                            {
                                var headers = new CHeaders();
    
                                var req_headers=oSession.oRequest.headers.ToArray();
                                for(var rh=0;rh<req_headers.Length;rh++)
                                    headers.Append(req_headers[rh].ToString());
                                
                                List<byte> req_bytes = new List<byte>{};
                                List<byte> header_bytes = new List<byte> { };
                                var end = false;
                                var headers_sended = false;
                                var md = my_downloader(oSession.fullUrl,headers,
                                    /*on data availible*/delegate(byte[] buf, int size, int nmemb, Object extraData)
                                    {
if (!headers_sended)
                                            {
                                                var headers_str = Encoding.UTF8.GetString(header_bytes.ToArray());
                                                oSession.oResponse.headers.AssignFromString(headers_str);
                                            }
                                        byte[] managedArray = new byte[size];
                                        Marshal.Copy(message, managedArray, 0, size);
                                        req_bytes.AddRange(managedArray);
                                            
                                        oSession.ResponseBody=req_bytes.ToArray();
                                        
                                        return size*nmemb;
                                    },
                                    /*on headers line availible*/delegate(byte[] buf, int size, int nmemb, Object extraData)
                                    {
                                        header_bytes.AddRange(buf);
                                        return size*nmemb;
                                    }
                                    );
                                md.Run();
                            }).Start();
                        }
}
}

0
Eric R | Senior Technical Support Engineer
Telerik team
answered on 01 Aug 2019, 04:02 PM
Hi Bedi,

Looking at the provided code, it is difficult to understand what the desired end goal is. Can you provide more information about what you would like to achieve with this?

Once I receive this information I can provide more relevant guidance. 

Please let me know if you need any additional information. Thank you for using Fiddler.

Regards,

Eric R
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
Bedi
Top achievements
Rank 1
answered on 01 Aug 2019, 08:00 PM

sorry bad english

i have stream downloader with difficult logic(p2p)(no sources)
and have a need to patch some bytes in the stream
stream downloader does not have http backend,
stream downloader have api /*on data availible*/
i want using fiddlercore and transmit data from stream downloader as stream.
i can create answer to http request without request to server by

oSession.oFlags["x-replywithtunnel"] ="AutoResponderWithNoFallthrough";
oSession.utilCreateResponseAndBypassServer();
oSession.responseBodyBytes = bytes;

also when proxying real request is availible to patch stream bytes using 
oSession.bBufferResponse = false;
and OnReadResponseBuffer callback

is it possible to stream request created by fiddlercore? using AutoResponderWithNoFallthrough and send data stream data from my api

0
Eric R | Senior Technical Support Engineer
Telerik team
answered on 06 Aug 2019, 03:35 PM
Hi Bedi,

You are correct. Fiddler can stream responses instead of buffering by setting the bBufferResponse flag to false. Although, streamed responses cannot be modified using Fiddler Inspectors. When streaming is enabled for a response, each block of data read from the server is immediately passed to the client application.

I hope this helps. Please let me know if you need any additional information. Thank you.

Regards,

Eric R
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
Tags
FiddlerCore
Asked by
Bedi
Top achievements
Rank 1
Answers by
Bedi
Top achievements
Rank 1
Eric R | Senior Technical Support Engineer
Telerik team
Share this question
or