cURL / Mailing Lists / curl-library / Single Mail


Re: A Question On Curl

From: Dan Fandrich <>
Date: Sat, 26 Jul 2014 22:41:54 +0200

On Sat, Jul 26, 2014 at 12:36:23PM -0700, Thomas Dineen wrote:
> The code shown below works about 98% of the time!
> About 2% of the time it will hang in url_fgets() maybe for 10
> minutes or
> more and sometimes longer.
> if the read fails that is ok, I just need it to return in an
> orderly predictable way.
> Any ideas why or how to debug?
> I thought the CURLOPT_TIMEOUT would prevent this?
> handle = url_fopen ( URL_String, "r" );
> curl_easy_setopt( handle, CURLOPT_TIMEOUT, (long) 10 );

You're mixing APIs here. url_fopen returns a URL_FILE* while
curl_easy_setopt takes a CURL*. fopen.c is really just a demo program
and isn't part of the libcurl API. You're free to modify it to add a
timeout using the CURL* handle directly, but it's not designed to be a
full-featured replacement for the curl easy API.

>>> Dan
List admin:
Received on 2014-07-26