cURL / Mailing Lists / curl-library / Single Mail

curl-library

Name lookup/DNS resolution mechanism of libcurl

From: Michael-O <1983-01-06_at_gmx.net>
Date: Sun, 31 Mar 2013 17:18:26 +0200

Hi,

I am facing an issue with the name resolution mechanism in libcurl. I
have compiled curl and libcurl myself, compiled and linked the example
simple.c statically and tried to pull a simple webpage to stdout. Every
call seems to be extremely slow. So, I have added
curl_easy_getinfo(curl, CURLINFO_NAMELOOKUP_TIME, &nslookup_time); and
realized that virtually the entire time is spent in name resolution. It
varies from five to ten seconds every time.

For instance:
D:\workspace-4.2\curlsimple\Debug>curlsimple.exe http://curl.haxx.se
Provided URL: http://curl.haxx.se
   % Total % Received % Xferd Average Speed Time Time Time
  Current
                                  Dload Upload Total Spent Left
  Speed
100 11804 100 11804 0 0 1962 0 0:00:06 0:00:06 --:--:--
  2518
Name lookup time: 5.875000 s
Connect time: 0.047000 s
Pretransfer time: 0.000000 s
start transfer time: 0.063000 s
Total time: 6.016000 s

I am on Windows XP SP3 32 bits, I have compiled curl with MingW32 with
GCC 4.5.2. Stripped it to a mininum:

curl 7.29.0 (i386-pc-win32) libcurl/7.29.0 WinSSL
Protocols: http https
Features: AsynchDNS GSS-Negotiate Largefile NTLM SSL SSPI

I tried several to resolve this issue:

1. Flushed DNS cache, no avail
2. Rebooted my router, no avail
3. Directly connected to the Internet w/o router, no avail
4. Changed DNS server in my computer and router from ISP's to Google's,
no avail

Finally I tried a virtual machine with the same OS and results come
instantly. I also analyzed the traffic with Wireshark. After the
invocation of simple.exe nothing happens for several seconds, boom name
is resolved and HTTP GET is issued. Using IP addresses works as desired.

Obviously, there is something wrong with my installtion/OS settings.
Strangely, other applications resolve names immediately like Firefox,
wget, etc.

What is so different about the name resolution in libcurl?
Has anyone else experienced this?

As a side note: when running the configure script in cygwin either for
curl or c-ares the script hangs on "checking types of args and return
type for recvfrom..." [1]

Thanks,

Michael

PS: My C knowledge is quite limited.

[1] http://forums.unrealircd.com/viewtopic.php?f=3&t=7349
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-03-31