Set my own value in C for use in VCL
Philip Prince
philip.prince at oxil.co.uk
Thu Jan 20 14:26:37 CET 2011
Dear List,
I am using Varnish 2.1.3 on Ubuntu 10.10.
I would like to use a C routine to set a value which I could pass on to VCL. I have made this simple start derived from examples I have seen on the web. I direct the request to a PHP file that streams out simulated data. If I comment out the VRT_SetHdr I get the expected data, otherwise I get an empty file.
C{
#include <stdlib.h>
}C
# This is a basic VCL configuration file for varnish. See the vcl(7)
# man page for details on VCL syntax and semantics.
#
# Default backend definition. Set this to point to your content
# server.
#
backend default {
.host = "89.151.80.99";
.port = "80";
}
sub vcl_miss {
C{
void setmyownvalue () {
VRT_SetHdr(sp, HDR_REQ, "\013X-My-Own-Value:", "1", vrt_magic_string_end);
}
setmyownvalue();
}C
if (req.http.X-My-Own-Value=="1"){
error 418 "Short and Stout";
}
return (fetch);
}
It has to be easy; my apologies for being so thick. I have looked for VRT documentation but I must be looking in all the wrong places...
Thank you,
Philip Prince
Oxford Information Labs Limited
The Magdalen Centre
Oxford OX4 4GA
t: 01865 784294
d: 01865 582040
m: 07595 894469
Legally privileged/Confidential Information may be contained in this message. If you are not the addressee(s) legally indicated in this message (or responsible for delivery of the message to such person) you may not copy or deliver this message to anyone. In such case, you should destroy this message, and notify us immediately. If you or your employer does not consent to Internet e-mail messages of this kind, please advise us immediately. Opinions, conclusions and other information expressed in this message are not given or endorsed by my firm or employer unless otherwise indicated by an authorised representative independent of this message. Please note that we do not accept any responsibility for viruses and we advise you to scan attachments.
Registered office: 37 Market Square, Witney, Oxfordshire OX28 6RE. Registered in England and Wales No. 4520925. VAT No. 799526263.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20110120/84cb4890/attachment-0003.html>
More information about the varnish-misc
mailing list