Inspect Request bodies?

Poul-Henning Kamp phk at
Wed Nov 5 20:37:30 CET 2008

In message <55911D51-8964-4D13-9667-63CACCD1A9A4 at>, Tim Kientzle wri

>  * I'll need code to actually read and store the POST body in memory
>    (including updates to the PASS handler and other places to
>    use the in-memory data when it's available)

We sort of have this as point 15 on our shoppinglist:


The crucial point here, is that we want it to be controllable in
VCL, so that people can disable it for GB sized uploads and enable
it for short stuff (or vice versa) if they want.

>  * I'll need to add VCL functions to actually analyze the POST body.

To be honest, I would would probably just use the inline C facility
and do it there, than trying to generalize it into a VCL extension.

>The first part looks trickier.  Has anyone here tried anything
>similar?  Any pointers (particular source files I should pay attention
>to or memory-management issues I should keep in mind)?

It's pretty straightforward really:  allocate an (non-hashed)
object, add storage to it and store the contents there.

You can see pretty much all the code you need in cache_fetch.c and
for it to go into the tree as a patch, I would insist that the
code gets generalized so we use the same code in both directions,
rather than have two copies.

Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.

More information about the varnish-misc mailing list