[PATCH] vmod_digest

Kristian Lyngstol kristian at varnish-software.com
Fri Oct 14 10:42:35 CEST 2011


Hi Laurence,

On Thu, Oct 13, 2011 at 11:24:25PM +0100, Laurence Rowe wrote:
> On 13 October 2011 18:45, Laurence Rowe <l at lrowe.co.uk> wrote:
> > How do you handle null bytes in the strings returned by digest.hash* /
> > digest.hmac* / digest.base64*decode ? I was under the impression
> > varnish used null terminated strings internally.
> 
> From reading the source I see that the hash and hmac functions return
> hexdigests. Presumably it's assumed any base64 data you would be
> interested in reading in Varnish would not contain null characters.

A valid point...

I could provide base64 functions that accept a length-argument too.
However, since there is no simple way to deal with NULL in VCL itself,
I'm curious if you have a use case for it? The only real use case I see
is if you combine it with other vmods.

I can actually see that happening with the nulldata vmod, now that I
think about it. It's not entirely unreasonable to have a base64-encoded
constant in your VCL, use the digest-vmod to decode it before the
nulldata-vmod sticks it in synthetic.

Then the problem becomes that you have to inform the caller of the
length. That shouldn't be a big deal either, but not quite as elegant as
I'd prefer.

Hmm....

- Kristian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: Digital signature
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-dev/attachments/20111014/55d53f2b/attachment-0003.pgp>


More information about the varnish-dev mailing list