curl-library
problems detecting CURLOPT_TIMECONDITION
Date: Tue, 15 Jan 2013 11:32:09 +0200
Hi,
First of all if there are any people involved with libcurl here
thanks, it's a very nice API and it's been a pleasure working with it.
I'm using curl_easy_setopt(curlHandle, CURLOPT_TIMECONDITION,
CURL_TIMECOND_IFMODSINCE); to only download a file if it has changed.
Curl does this nicely and it works just fine, it won't download the
file if it doesn't need to. Now comes my problems though, I need to
detect if CURLOPT_TIMECONDITION applied or not.
I've been looking for a way to do this and the only option I've
found if to read the return code CURLINFO_RESPONSE_CODE but this is
different for FTP and it doesn't work properly for me when using a
proxy, and CURLINFO_HTTP_CONNECTCODE didn't really work either (
returned 0 ).
I've thought about also checking the size of the download and that
could work if size == 0 and ret code was CURLE_OK however these are
all hacks in my opinion. The best way to do this would be to define a
new option and get the result with:
curl_easy_getinfo(curlHandle, CURLINFO_TIMECONDITION_APPLIED, &rcVal);
which would return 1 in case the time condition was applied and the
file wasn't downloaded or 0 otherwise.
Is what I'm proposing reasonable ? I've yet to look at the code
but I think if nobody else wants to do this I could send a patch for
it myself.
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-01-15