<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Dear List,<div><br></div><div>I am using Varnish 2.1.3 on Ubuntu 10.10.<br><div><br></div><div>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.</div><div><br></div><div><div><font class="Apple-style-span" face="Courier">C{</font></div><div><font class="Apple-style-span" face="Courier"> #include <stdlib.h></font></div><div><font class="Apple-style-span" face="Courier">}C</font></div><div><font class="Apple-style-span" face="Courier"><br></font></div><div><font class="Apple-style-span" face="Courier"># This is a basic VCL configuration file for varnish. See the vcl(7)</font></div><div><font class="Apple-style-span" face="Courier"># man page for details on VCL syntax and semantics.</font></div><div><font class="Apple-style-span" face="Courier">#</font></div><div><font class="Apple-style-span" face="Courier"># Default backend definition. Set this to point to your content</font></div><div><font class="Apple-style-span" face="Courier"># server.</font></div><div><font class="Apple-style-span" face="Courier">#</font></div><div><font class="Apple-style-span" face="Courier">backend default {</font></div><div><font class="Apple-style-span" face="Courier"> .host = "89.151.80.99";</font></div><div><font class="Apple-style-span" face="Courier"> .port = "80";</font></div><div><font class="Apple-style-span" face="Courier">}</font></div><div><font class="Apple-style-span" face="Courier"><br></font></div><div><font class="Apple-style-span" face="Courier">sub vcl_miss {</font></div><div><font class="Apple-style-span" face="Courier"><br></font></div><div><font class="Apple-style-span" face="Courier"> C{</font></div><div><font class="Apple-style-span" face="Courier"> void setmyownvalue () {</font></div><div><font class="Apple-style-span" face="Courier"> VRT_SetHdr(sp, HDR_REQ, "\013X-My-Own-Value:", "1", vrt_magic_string_end);</font></div><div><font class="Apple-style-span" face="Courier"> }</font></div><div><font class="Apple-style-span" face="Courier"> setmyownvalue();</font></div><div><font class="Apple-style-span" face="Courier"> }C</font></div><div><font class="Apple-style-span" face="Courier"><br></font></div><div><font class="Apple-style-span" face="Courier"> if (req.http.X-My-Own-Value=="1"){</font></div><div><font class="Apple-style-span" face="Courier"> error 418 "Short and Stout";</font></div><div><font class="Apple-style-span" face="Courier"> }</font></div><div><font class="Apple-style-span" face="Courier"><br></font></div><div><font class="Apple-style-span" face="Courier"> return (fetch);</font></div><div><font class="Apple-style-span" face="Courier">}</font></div></div><div><br></div><div>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...</div><div><br></div><div>Thank you,<br><div>
<div><p style="font-family: helvetica, arial, sans-serif; margin-bottom: 1em; "><b>Philip Prince</b> </p><img moz-do-not-send="true" src="http://www.oxil.co.uk/Direct/OxilEmailLogo.jpg" alt="Oxil Software" width="227" height="132"><p style="font-family: helvetica, arial, sans-serif; margin-bottom: 1em; margin-top: 1em; "><b>Oxford Information Labs Limited</b></p><p style="font-family: helvetica, arial, sans-serif; margin-bottom: 1em; ">The Magdalen Centre<br>Oxford OX4 4GA</p><p style="font-family: helvetica, arial, sans-serif; margin-bottom: 1em; ">t: 01865 784294<br>d: 01865 582040<br>m: 07595 894469</p><p style="font-family: helvetica, arial, sans-serif; margin-bottom: 1em; font-size: small; ">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.</p><p style="font-family: helvetica, arial, sans-serif; margin-bottom: 1em; font-size: small; ">Registered office: 37 Market Square, Witney, Oxfordshire OX28 6RE. Registered in England and Wales No. 4520925. VAT No. 799526263.</p></div>
</div>
<br></div></div></body></html>