cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: CURLE_COULDNT_RESOLVE_HOST using libcurl easy interface

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Wed, 19 Dec 2012 22:18:30 +0100

On Wed, Dec 19, 2012 at 04:10:46PM -0500, Dave Galloway wrote:
> I must be losing it because I can't seem to see the problem. I have cut down my test program to a bare minimum.
> I have tried a newer version of libcurl, 7.21.4 instead of 7.19.6, that I had locally.
> If I call curl_easy_setopt(curl, CURLOPT_URL, "google.com") after initializations and such and then curl_easy_perform(curl) it fails.

Note that "google.com" isn't a URL--it's a host name. libcurl tries to
guess correctly what protocol you want in cases like this, but you
shouldn't depend on it.

> If I call curl_easy_setopt(curl, CURLOPT_URL, "74.125.140.101") it works.
> The failure is on CentOS 5.4. Works fine both ways on the older Red Hat box and my Win 7 box.
> At the getaddrinfo level in curl_addrinfo.c I am getting a -2 (NONAME) error which bubbles back up and eventually returns the CURLE_COULDNT_RESOLVE_HOST error.
> I can ping google.com and 74.125.140.101 from the command line on all systems with no problem.
> Any good ideas? Next up is to build the latest libcurl.

What name resolver back-end is your libcurl configured to use?

>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-12-19