pexlib1.0/curl.c

Bradley Giesbrecht pixilla at macports.org
Sat Sep 6 08:19:37 PDT 2014


On Sep 5, 2014, at 6:26 PM, Brandon Allbery <allbery.b at gmail.com> wrote:

> 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).

That was it! The url was not valid. Thanks for helping me understand where the error was coming from.


Regards,
Bradley Giesbrecht (pixilla)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 455 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <https://lists.macosforge.org/pipermail/macports-dev/attachments/20140906/5cbb8386/attachment.sig>


More information about the macports-dev mailing list