cURL / Mailing Lists / curl-library / Single Mail

curl-library

Error messages for threaded resolver

From: Jeff Pohlmeyer <yetanothergeek_at_gmail.com>
Date: Mon, 25 Apr 2011 19:10:23 -0500

Using the threaded resolver on ArchLinux with a non-existent hostname:

% curl http://nosuch.not/

curl: (6) Could not resolve host: nosuch.not; Cannot allocate memory

Somehow that error just doesn't look right!

The attached patch stores the return value of Curl_getaddrinfo_ex() in
tsd->sock_error and uses gai_strerror() to provide a more descriptive
message. It assumes that gai_strerror is available if HAVE_GETADDRINFO
is defined. I don't know if that's actually true, but it appears to be
available for at least MS-Windows, MinGW, Linux (glibc/uClibc),
FreeBSD, and MINIX.

Someone more familiar with the code can probably come up with a better
solution, but hopefully this is a step in the right direction...

 - Jeff

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html

Received on 2011-04-26