Hello,
I have a very strange behavior, I build on a Java program a request to query a site. For your information, here is the code, but it's not the root of the problem:
conn = (HttpURLConnection) url.openConnection();
conn.setConnectTimeout(SimpleCrawler.timeout);
conn.setReadTimeout(SimpleCrawler.timeout);
conn.setRequestProperty( "Host", url.getAuthority() );
conn.setRequestProperty( "User-Agent", userAgent );
conn.setRequestProperty( "Accept", SimpleCrawler.acceptPageType);//text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
conn.setRequestProperty( "Accept-Language", SimpleCrawler.acceptLanguage );
conn.setRequestProperty( "Accept-Encoding", "gzip, deflate, br" );
InputStream input = conn.getInputStream();
byte[] buffer = new byte[4096];
int n;
OutputStream output = new FileOutputStream( chemin );
while ((n = input.read(buffer)) != -1)
{
output.write(buffer, 0, n);
}
output.close();
And the request downloads a corrupted file. Now if I go through fiddler with this code :
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("127.0.0.1", 8888));
conn = (HttpURLConnection) url.openConnection(proxy);
I see the request go through Fiddler and the file downloads correctly.
It's as if Fiddler modified the return or the request by reorganizing something to correct a problem that was there before. But I can't figure out what it is, if I knew I'd fix my problem.
Do you have any idea why I am seeing this behavior?
Thanks
This is the code I am currently using.
if (oSession.fullUrl.Contains("go_proxy=1"))
{
oSession["ui-backcolor"] = "green";
oSession["x-OverrideGateway"] = "socks=192.168.5.201:1080";
FiddlerObject.log("log:"+oSession["X-OverrideGateway"]);
}
Strangely, when I set the proxy outside the if statement, it works. But when I set the proxy inside the if statement, it doesn't work.
oSession["x-OverrideGateway"] = "socks=192.168.5.201:1080";
if (oSession.fullUrl.Contains("go_proxy=1"))
{
oSession["ui-backcolor"] = "green";
oSession["x-OverrideGateway"] = "socks=192.168.5.201:1080";
FiddlerObject.log("log:"+oSession["X-OverrideGateway"]);
}
I set the session to green in the if code block, and I can see in the log that the code has taken effect. That is, the judgment code is valid, but the proxy setting is invalid.
I don't know why? Please help me, thank you very much!
I want to use fiddler to switch the javascript files
I've solve the cors policy, but I don't know to to set the rules to allow my script bypass the integrity tags
looking for help