Inline C and memory allocation

Laurence Rowe l at
Tue Jul 7 11:56:13 CEST 2009

I'm not certain if I need to manage the memory of the string that I
set the header too. It looks like VRT_SetHdr copies the string into
it's own memory managed space though.

That just leaves me with the task of allocating enough memory to
perform base64 decoding, md5 calculation etc. I guess I can just
allocate a large buffer on the stack and test that I won't overrun it.

2009/7/7 Ken Brownfield <kb+varnish at>:
> Isn't VRT_SetHdr() what you're looking for?  Mind its semantics, though.
> --
> Ken.
> On Jul 6, 2009, at 7:26 AM, Laurence Rowe wrote:
>> Hi,
>> Thought my C is rather rusty by now, I'd like to make the mod_auth_tkt
>> [1] signed cookie authentication / authorisation system work with
>> Varnish. The idea would be to encode the acceptable authorisation
>> tokens for a page into it's response header then check the tokens in
>> the user's auth_tkt cookie against the tokens in the cached header
>> during vcl_deliver.
>> I can find examples online that read data from headers using
>> VRT_GetHdr, but in order to implement/port mod_auth_tkt I will need to
>> decode the data in the cookie and write the decoded contents to new
>> headers. With apache, I would use apr_psprintf or similar to allocate
>> memory from the pool. What would be the equivalent in Varnish?
>> Laurence
>> [1]
>> _______________________________________________
>> varnish-misc mailing list
>> varnish-misc at

More information about the varnish-misc mailing list