New VMOD - timeutils

Federico Schwindt fgsch at lodoss.net
Thu Oct 18 13:09:56 CEST 2012


On Thu, Oct 18, 2012 at 1:58 AM, Jeremy Thomerson
<jeremy at thomersonfamily.com> wrote:
> Devs,
>
>   I just created a new VMOD [0] and would love if some of you could look
> over it.  It's my first one.  The primary reason I created it was so that I
> could avoid having to have inline C in my VCL as suggested at [1].  I asked
> about this a few weeks ago on IRC and was told the best way to contribute a
> way of doing this was to create a VMOD.  Ironically, today when I was
> getting ready to publish my VMOD, I came across [2] where one of the two
> things I needed to accomplish was discussed.  However, my VMOD goes beyond
> what was discussed in that patch in order to provide additional
> functionality.
> [..]

Hi,

I haven't looked at your vmod to comment but the TIME + DURATION issue
has been properly fixed in commit
cc513fdc6cc098fcdc378af6ec80959a5c744054 so now it's possible to do:

set resp.http.foo = now + 1s;

That will return a RFC date.
[1] could be achieved with:

set resp.http.foo = now + std.duration(regsub(resp.http.cache-control,
".* maxage=([0-9]*).*", "\1s"), 10s);

Cheers,

f.-



More information about the varnish-dev mailing list