cURL / Mailing Lists / curl-library / Single Mail

curl-library

Flag to know if the curl object used a previously opened connection

From: Guillaume Arluison <ga_at_lacde.net>
Date: Mon, 11 Oct 2004 18:02:18 +0100

Hi all,

I'm new here, I use curl for months and it really rocks ! The documentation
and simplicity of use is just great ! Thank you for curl[lib] !

I'm starting now to use libcurl directly in my programs instead of using the
command line so I'm a bit new to use libcurl I must admit.
I looked for a previous answer to my question in the docs and in some months
of the mailing list but didnt find any so I'll try to do not waste too much
of your time with the following :

libcurl is clever enough to spool the connections (5 by default) to be
re-used if available. I need to mimic the behaviour of a 'classic' browser
so this is really cool. When using the CURLOPT_VERBOSE to 1 one can see when
the engine reused the connection or had to open a new one. I would like to
"know" this with a simple flag in my code. I looked for all the options in
curl_easy_getinfo but didnt find any. And of course dont want to use VERBOSE
in production and look at the file generated.

So do I have to force a debugfunction in curl_easy_setopt and tries to
manipulate the CURLOPT_DEBUGDATA and will it work ? (remember that it is in
production use not just for debug)

Another way is to get the CURLINFO_CONNECT_TIME, this figure gives a hint
because it is exceptionnaly quick when it use the same connection, however
it is not 0 and the value may differ. Usually between 1e-05 and 3e-05 but
well this is not really a reliable test : if CONNECT_TIME < 5e-05 then
WAS_REUSED=1...

Is there any internal documentation on this ?

And well if there is no easy way to do this, may I kindly ask to add a
boolean CURLINFO_REUSED_CONNECTION in curl_easy_getinfo that returns if it
uses or not a previously opened connection ?

I can try to spend some time on the code to propose a patch if you need.

Regards,
_______________________________
Guillaume Arluison

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.764 / Virus Database: 511 - Release Date: 15/09/2004
Received on 2004-10-11