Req_body functions (length, hash, regex)

Arianna Aondio arianna.aondio at
Mon Mar 23 15:47:46 CET 2015

Hi everyone,
please find patch attached.

This is a proposed solution for 3 req.body functions: len_req_body,
hash_req_body and rematch_req_body.

The idea is to iterate over the request body, wrap it into a blob (I
have to thank Nils for this because I took the idea from the vmod he
wrote a couple of weeks ago) and use this blob for operation such as
hashing on it or regex matching.

*len_req_body: check if the req.body has been buffered, if so then we
return the number of consumed bytes.

*hash_req_body: first the req.body is collected in a blob, then we
hash on this (I had to implement a new function for hashing on binary

*rematch_req_body: using a priv_call the regular expression given as
parameter is compiled just once, then we use VRE_exec on the req.body
blob to check if there's a regex match.

Comments much appreciated.

Arianna Aondio
Software Developer | Varnish Software AS
Mobile: +47 980 62 619

We Make Websites Fly
-------------- next part --------------
A non-text attachment was scrubbed...
Name: req_body_functions.patch
Type: text/x-diff
Size: 10616 bytes
Desc: not available
URL: <>

More information about the varnish-dev mailing list