cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Can't resolve host

From: Mathieu Fregeau <mathieu.fregeau_at_gmail.com>
Date: Mon, 9 Mar 2015 14:42:10 -0700

The LAN settings in Internet Explorer (which is the official configured client at my company) is set at "use automatic configuration script" and points to a .pac file on the Ethernet. The proxy parameters are left blank and are disabled.

I can run Firefox though which I needed to add a few domain names under "network.automatic-ntlm-auth.trusted-Uris" (several domain separated by comas) as well as the same settings under "network.negotiate-auth.delegation-uris" and "network.negotiate-auth.thrusted-uris"

I came to know which domain to add to these Firefox settings after I clicked a non-Ethernet link and Firefox would tell me that such and such domain wasn't on the approved list or something.

Possibly that one of these (or all) is a proxy. Can libcurl accepts a list of proxy so I can try mimicking Firefox perhaps? I guess my main question now is do I need to focus on the proxy settings or could it be another setting instead? Thanks for your inputs.

M

> On Mar 9, 2015, at 1:32 PM, Ray Satiro via curl-library <curl-library_at_cool.haxx.se> wrote:
>
>> On 3/5/2015 7:52 PM, Mathieu Fregeau wrote:
>> library version: curl 7.41.0
>> compiler: c++, mingw32 (gcc 4.8)
>>
>> I can't resolve my request when at the office computer, while it works well at home. I suspect something about firewall, but I can browse on the same url via a browser (firefox and ie). Is there a way to have curl use the same exact settings of the current browser? such that I can use the same channels or firewall bypass?
>>
>> Here are my request settings:
>>
>> curl_easy_setopt(curl, CURLOPT_URL, url);
>> curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);//follow redirection
>> curl_easy_setopt(curl, CURLOPT_REFERER, url);
>> curl_easy_setopt(curl, CURLOPT_HEADER, 0L);
>> curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1L);//no progress
>> curl_easy_setopt(curl, CURLOPT_VERBOSE, 0L);//1=verbose, 0=non verbose
>> curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
>> curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_WHATEVER);
>> curl_easy_setopt(curl, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS | CURLPROTO_FILE | CURLPROTO_SCP);
>> curl_easy_setopt(curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.1; WOW64) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912 Safari/535.7 Firefox/3.5.16");
>> curl_easy_setopt(curl, CURLOPT_AUTOREFERER, 1L);
>> curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1L);//report failure for http code > 400
>> curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, CurlWriteFunction);//function to keep response
>> curl_easy_setopt(curl, CURLOPT_WRITEDATA, &body);// keep response in variable
>>
>> res = curl_easy_perform(curl);
>>
>> like I said it works from my home computer but just not at work.
>
> Go into Internet Options > Connections > LAN settings and see if you have a proxy server. You can use CURLOPT_PROXY to set the proxy [1]. There isn't functionality in libcurl to get that proxy configuration automatically, though you can find some code that shows how to do that at [2].
>
> Also I'm reminded of a similar "can't resolve host" in windows question on the mailing list a week ago where the user had only partially initialized libcurl [3]. Absent that try my suggestions from that thread [4].
>
>
> [1]: http://curl.haxx.se/libcurl/c/CURLOPT_PROXY.html
> [2]: http://stackoverflow.com/questions/202547/how-do-i-find-out-the-browsers-proxy-settings
> [3]: http://curl.haxx.se/mail/lib-2015-03/0061.html
> [4]: http://curl.haxx.se/mail/lib-2015-03/0046.html
>
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette: http://curl.haxx.se/mail/etiquette.html

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2015-03-09