cURL / Mailing Lists / curl-library / Single Mail



From: Don Mies (NIM) <>
Date: Mon, 12 Nov 2007 14:39:20 -0800


Please excuse me if this an elementary question as I've just begun using

libcurl. I've read all the documentation and example programs that I
can find

and have not been able to get my program to work as I'd like.


Basically I'd like to poll a web server to see if a file has been

since the last time I downloaded it. I'm trying to use the

function for this and cannot get it to work.


I'm using on a RedHat 5.0.0 system.



Here's my test program:


    int main(int argc, char **argv)


      CURL *curl_handle;

      time_t fileTime = 1;




      curl_handle = curl_easy_init();


      curl_easy_setopt(curl_handle, CURLOPT_URL, ""


      curl_easy_setopt(curl_handle, CURLOPT_NOBODY, 1 );


      curl_easy_setopt(curl_handle, CURLOPT_FILETIME, &fileTime );




      printf ( "Got file time %d - %s\n", fileTime, ctime(&fileTime));




      return 0;



No matter what I do, it does not appear to update my fileTime variable.

always get:


    % curlTest

    Got file time 1 - Wed Dec 31 16:00:01 1969


I've checked the return status on all of the calls (omitted here for

and none of the functions are returning any errors. I've also tried it
on a

variety of web servers including our own in-house server and they all

the same way.


When I download the header and body of one of these locations the header

looks something like:


    HTTP/1.1 200 OK

    Date: Mon, 12 Nov 2007 21:38:10 GMT

    Server: Apache/2.2.4 (Unix) mod_ssl/2.2.4 OpenSSL/0.9.8b

    Last-Modified: Mon, 12 Nov 2007 21:04:34 GMT

    ETag: "24cec5-24ec5b-ade63c80"

    Accept-Ranges: bytes

    Content-Length: 2419803

    Content-Type: text/plain


which contains a "Last-Modified" date.


What am I doing wrong?






Received on 2007-11-12