Compare Hex to Decimal

Michael Kennedy michael at kennedy.ie
Fri Apr 13 15:42:29 UTC 2018


Hi,


I have a URL that contains a Unix hex timestamp (something like 5ace8c5d). The timestamp should be within X minutes of now, and is used as part of an access control mechanism. I want to do something like this:


if (std.time(req.http.x-hextime, now) < now - 1w) {
...
}

Is there an efficient way in VCL to either convert Hex to Dec so that this comparison can be done, or some other solution that does not involve changing the data in the URL.

Thanks,

Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20180413/2553b313/attachment.html>


More information about the varnish-misc mailing list