Learning C and VRT_SetHdr()

Cosimo Streppone cosimo at streppone.it
Thu Mar 31 13:58:54 CEST 2011

On Thu, 31 Mar 2011 22:39:51 +1100, Dan <dan at retrobadger.net> wrote:

> The snipper from my current code is:

Is it correct to do this in all
vcl_miss, pipe and pass?
What about vcl_hit then?

I would have expected this to happen in vcl_deliver()
or vcl_fetch() if you want your backends to see
the header you're setting.


> /sub detectmobile {/
> /  C{/
> /    VRT_SetHdr(sp, HDR_BEREQ, "\020X-Varnish-TeraWurfl:", "no1",
> vrt_magic_string_end);/
> /  }C/

I believe you have a problem in the "\020" bit.
That is octal notation.

"X-Whatever:" is 11 bytes, including the ':',
so you need to write:


Have fun,


More information about the varnish-misc mailing list