cURL / Mailing Lists / curl-library / Single Mail


Re: Can't resolve host

From: Ray Satiro via curl-library <>
Date: Mon, 09 Mar 2015 16:32:09 -0400

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_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


List admin:
Received on 2015-03-09