cURL / Mailing Lists / curl-library / Single Mail

curl-library

easy_perform() hangs on HEAD request

From: Ram <ramkumar.h_at_gmail.com>
Date: Wed, 2 Sep 2009 14:13:37 -0400

Hi All,
   When I set the CURLOPT_NOBODY to 1 to read only the header information, I
see that curl does not timeout if the server is not reachable.
I disconnected the ethernet cable from the server and tried to read the
header with curl_easy_perform, but it would just keep waiting for the server
to timeout.

I tried setting connection timeout, timeout, low speed limits but it doesn't
work with NOBODY option set to true.
I am able to timeout properly if I disconnect the cable after reading the
header and while reading the body (without nobody and using GET)

Is this a bug in curl or am i missing something? Please help. I am using
libcurl version 7.19.5.

-------------------
The following are the options I set

curl_easy_setopt(cHandle, CURLOPT_URL, urlname);
curl_easy_setopt(cHandle, CURLOPT_USERAGENT, "curl/7.19.5 (i386-pc-win32)
libcurl/7.19.5 OpenSSL/0.9.8k zlib/1.2.3");
curl_easy_setopt(cHandle, CURLOPT_HEADER, 0);
curl_easy_setopt(cHandle, CURLOPT_MAXREDIRS, 20);

curl_easy_setopt(cHandle, CURLOPT_CONNECTTIMEOUT, 2);
curl_easy_setopt(cHandle, CURLOPT_TIMEOUT, 2);
curl_easy_setopt(cHandle, CURLOPT_NOPROGRESS, 1);
curl_easy_setopt(cHandle, CURLOPT_NOBODY, 1);

 curl_easy_perform(cHandle);
--------------------

Thanks
Ram
Received on 2009-09-02