Hi.
Using the same handle I want to download the same URL (e.g. microsoft.com) 
first time without proxy and second time with wrong proxy. 

In order to achieve that I am setting proxy to empty string before the first 
download:curl_easy_setopt(handle, CURLOPT_PROXY, "");curl_easy_perform(handle);

 And setting it to something wrong before the second download: 
curl_easy_setopt(handle, CURLOPT_PROXY, "wrong:80");curl_easy_perform(handle);

 The expected correct result would be to succeed for the first time, and to 
fail for the second time, because the second download is using wrong proxy.
But the actual result I am seeing is successful downloads for both cases. So I 
have the impression that although I am changing proxy option before triggering 
second transfer, the second transfer reuses the successfully established 
connection (one without proxy) instead of trying to create a new connection 
with new proxy information. 
I have also tried with CURLOPT_FRESH_CONNECT and CURLOPT_FORBID_REUSE options 
but didn't observe any change in behavior.
Two observations that I have made are:
1. If instead of immediately triggering the second download I wait for 2 
minutes and only then trigger the second download with wrong proxy, the 
behavior is as expected (the second download fails).
2. This issue occurs only when my wrong proxy address has port 80 
(somewrongproxy:80). If I specify wrong proxy with port other than 80, 
everything works as expected.
So can you please help me figure out how is port 80 special in this case and 
how I can reuse same libcurl handle so that proxy changes between transfers 
take effect.
Thanks in advance.
-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:  https://curl.haxx.se/mail/etiquette.html

Reply via email to