pexlib1.0/curl.c

Brandon Allbery allbery.b at gmail.com
Fri Sep 5 18:26:19 PDT 2014


On Fri, Sep 5, 2014 at 9:10 PM, Bradley Giesbrecht <pixilla at macports.org>
wrote:

> I'm trying to write a function to return the remote file moddate. I copied
> isnewer and changed the end as so.
> ...
>                 theModDate = 0;
>
>         /* get the modification date */
>         theCurlCode = curl_easy_getinfo(theHandle, CURLINFO_FILETIME,
> &theModDate);
>         if (theCurlCode != CURLE_OK) {
>             theResult = SetResultFromCurlErrorCode(interp, theCurlCode);
>             break;
>         }
>
>                 (void) snprintf(theModDateString, sizeof(theModDateString),
>                         "%Ld", theModDate);
>                 Tcl_SetResult(interp, theModDateString, TCL_VOLATILE);
>
> ...
>
> Is there anything obviously with the snprintf args, or anything else?
> It appears to always return "-1";
>

-1 implies that it's curl_easy_getinfo that is failing, not the sprintf.
The reasons for this can include things like (a) the web server doesn't
support it, and (b) you didn't use curl_easy_setopt to specify beforehand
to get the information (see
http://curl.haxx.se/libcurl/c/curl_easy_getinfo.html#CURLINFOFILETIME).

-- 
brandon s allbery kf8nh                               sine nomine associates
allbery.b at gmail.com                                  ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-dev/attachments/20140905/3c4f4470/attachment-0001.html>


More information about the macports-dev mailing list