cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: CURLOPT_TIMEOUT_MS < 1000 - requests not reaching server

From: Rakesh Sinha <rakesh.usenet_at_yahoo.com>
Date: Wed, 20 Feb 2013 11:36:10 -0800 (PST)

So - adding the following option helped.  curl_setopt( $c, CURLOPT_NOSIGNAL, 1);  ( More details here at: http://www.leftontheweb.com/message/Setting_millisecondtimeouts_with_curl ) .  Now indeed it worked.  But- as I tried to understand more about NOSIGNAL option,  the document says:  http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTNOSIGNAL .  "Consider building libcurl with c-ares support to enable asynchronous DNS lookups, which enables nice timeouts for name resolves without signals"  My distribution comes prepackages with libcurl .  How would I know , now if it has been built with c-ares support though ?   ________________________________ From: Rakesh Sinha <rakesh.usenet@yahoo.com> To: "curl-library@cool.haxx.se" <curl-library@cool.haxx.se> Sent: Thursday, February 21, 2013 12:41 AM Subject: CURLOPT_TIMEOUT_MS < 1000 - requests not reaching server I am using the curl extension of php , to talk to a server  ( local server, for test purposes).  Unless I set, both CURLOPT_CONNECTTIMEOUT_MS and CURLOPT_TIMEOUT_MS, to at least 1000 , the request does not even reach the server, from the client  . What could be going wrong here, with the code fragment / libraries ( curl / php )  though ?  ( clienttest.php ):  //  original code: http://stackoverflow.com/questions/6801795/php-curl-timeout-ignored <?php $version = curl_version();  print_r($version); $defaults = array(   CURLOPT_RETURNTRANSFER => TRUE,   CURLOPT_FOLLOWLOCATION => TRUE,   CURLOPT_NOBODY => TRUE,   CURLOPT_PROTOCOLS => CURLPROTO_HTTP | CURLPROTO_HTTPS,   CURLOPT_CONNECTTIMEOUT_MS => 1000,   CURLOPT_TIMEOUT_MS => 1000,   CURLOPT_MAXREDIRS => 5,   CURLOPT_USERAGENT => 'RandomAgent', ); $url='http://localhost:1234'; $ch = curl_init($url); curl_setopt_array($ch,  $defaults); $doc = curl_exec($ch); ?> System Information:  Curl version:  7.27.0 Array (     [version_number] => 465664     [age] => 3     [features] => 50813     [ssl_version_number] => 0     [version] => 7.27.0     [host] => x86_64-pc-linux-gnu     [ssl_version] => OpenSSL/1.0.1c     [libz_version] => 1.2.7     [protocols] => Array         (             [0] => dict             [1] => file             [2] => ftp             [3] => ftps             [4] => gopher             [5] => http             [6] => https             [7] => imap             [8] => imaps             [9] => ldap             [10] => ldaps             [11] => pop3             [12] => pop3s             [13] => rtmp             [14] => rtsp             [15] => smtp             [16] => smtps             [17] => telnet             [18] => tftp         ) ) $ php --version PHP 5.4.6-1ubuntu1.1 (cli) (built: Nov 15 2012 01:18:34)  Copyright (c) 1997-2012 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies     with XCache v2.0.0, Copyright (c) 2005-2012, by mOo     with Xdebug v2.2.1, Copyright (c) 2002-2012, by Derick Rethans ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette:  http://curl.haxx.se/mail/etiquette.html

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-02-20