cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Timeouts and using CURLOPT_FRESH_CONNECT

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Thu, 27 Nov 2003 08:57:48 +0100 (CET)

On Wed, 26 Nov 2003, Andrew Fuller wrote:

> I just want to clarify the use of CURLOPT_FRESH_CONNECT because the docs say
> only to use it if you know what it does, and I guess I don't :)

;-)

> Suppose I use a curl handle to fetch a document which times out, for example
> :
>
> Set CURLOPT_TIMEOUT to 5. Fetch http://domain.com/mypage.jsp?delay=10 (takes
> 10s)
>
> After this times out, I want to use the same handle to fetch a document from
> the same location, but with different params, eg :
> http://domain.com/mypage.jsp?delay=3
>
> At present, the second fetch uses the connection from the first, and the
> response I get back is from the first request.

That sounds exactly like a bug description! Would you be able to provide us
with the source of a program that repeats this problem on a public URL?

When libcurl times out, it really must close the connection since it can't be
re-used later without risking exactly what you describe.

> To correct this, should I set CURLOPT_FRESH_CONNECT to 1 every time a fetch
> times out? Does this only affect the next fetch?

FRESH_CONNECT makes the new request not attempt to re-use an existing
conection, so if you set that on your second request it should suffice as a
work-around for this particular problem. But still, this problem is a bug that
we should fix...

-- 
    Daniel Stenberg -- http://curl.haxx.se/ -- http://daniel.haxx.se/
 [[ Do not post private mails to this email address. They won't reach me. ]]
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
Received on 2003-11-27