<meta http-equiv="content-type" content="text/html; charset=utf-8"><span class="Apple-style-span" style="-webkit-text-decorations-in-effect: none; "><pre style="border-collapse: separate; font-family: 'Times New Roman'; font-style: normal; font-size: medium; white-space: pre-wrap; ">
Ken Brownfield,</pre><pre style="border-collapse: separate; font-family: 'Times New Roman'; font-style: normal; font-size: medium; white-space: pre-wrap; ">Using the command you mentioned (with the "-C" option on varnish daemon) I was able to find my mistake.</pre>
<pre><font class="Apple-style-span" face="'Times New Roman'" size="3" style="border-collapse: collapse; font-family: arial, sans-serif; "><span class="Apple-style-span" style="border-collapse: separate; white-space: pre-wrap;">I was initializing a variable with a "Varnish Run Time" value. Since this value is only </span></font><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="white-space: pre-wrap;">accessible</span></font><font class="Apple-style-span" face="'Times New Roman'" size="3" style="border-collapse: collapse; font-family: arial, sans-serif; "><span class="Apple-style-span" style="border-collapse: separate; white-space: pre-wrap;"> when a request is made, varnishd was not able to compile my code.</span></font></pre>
<pre><font class="Apple-style-span" face="'Times New Roman'" size="3" style="border-collapse: collapse; font-family: arial, sans-serif; "><span class="Apple-style-span" style="border-collapse: separate; white-space: pre-wrap;">The wrong code:</span></font></pre>
<pre><font class="Apple-style-span" face="arial, sans-serif" size="3"><span class="Apple-style-span" style="white-space: pre-wrap;"><i>        char xqbkey[32] = VRT_GetHdr(sp, HDR_REQ, "\012X-API-Key:");</i></span></font></pre>
</span><span class="Apple-style-span" style="font-family: arial, sans-serif; white-space: pre-wrap; font-size: medium; ">And what I did after seeing my mistake:</span><span class="Apple-style-span" style="-webkit-text-decorations-in-effect: none; "><pre>
<font class="Apple-style-span" face="arial, sans-serif" size="3"><span class="Apple-style-span" style="white-space: pre-wrap;"><i>        char apikey[32];
        sprintf(apikey, VRT_GetHdr(sp, HDR_REQ, "\012X-API-Key:"))</i></span></font></pre><pre style="border-collapse: separate; font-family: 'Times New Roman'; font-style: normal; font-size: medium; white-space: pre-wrap; ">
<br></pre><pre style="border-collapse: separate; font-family: 'Times New Roman'; font-style: normal; font-size: medium; white-space: pre-wrap; ">Thanks for the tip.</pre><pre style="border-collapse: separate; font-family: 'Times New Roman'; font-style: normal; font-size: medium; white-space: pre-wrap; ">
Best Regards</pre><pre style="border-collapse: separate; font-family: 'Times New Roman'; font-style: normal; font-size: medium; white-space: pre-wrap; ">Roberto Moutinho</pre><pre style="border-collapse: separate; font-family: 'Times New Roman'; font-style: normal; font-size: medium; text-decoration: underline; white-space: pre-wrap; ">
<br></pre><pre style="border-collapse: separate; font-family: 'Times New Roman'; font-style: normal; font-size: medium; text-decoration: underline; white-space: pre-wrap; ">Actually, more useful would be the output of "varnishd -C -f
/path/to/your/VCL/file.vcl", in whole or primarily the area around line
602...  Not sure how to get away without actually looking at the cause of
the error.  If it just said "syntax error", Google wouldn't be too helpful
for that, either... :-/
-- 
kb


On Fri, Jul 22, 2011 at 16:24, Roberto Moutinho
<<a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc">robertomoutinho at gmail.com</a>>wrote:

><i> My mistake... I've posted the wrong link.
</i>><i>
</i>><i> this is the one I was referring to:
</i>><i>
</i>><i> <a href="http://drcarter.info/2010/04/how-fighting-against-scraping-using-varnish-vcl-inline-c-memcached/">http://drcarter.info/2010/04/how-fighting-against-scraping-using-varnish-vcl-inline-c-memcached/</a>
</i>><i>
</i>><i>
</i>><i>
</i>><i> 2011/7/22  Ken Brownfield <<a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc">kbrownfield at google.com</a>>
</i>><i> Hard to tell without seeing any code at all, and I "C" no code at that
</i>><i> link.
</i>><i> :)
</i>><i>
</i>><i> OT: I think scaling 100 million requests a month is a... dubious
</i>><i> accomplishment -- 38 hits per second?  Really?
</i>><i> --
</i>><i> kb
</i>><i>
</i>><i> 2011/7/22 Jonathan Hursey <<a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc">jonathan.hursey at adrevolution.com</a>>
</i>><i>
</i>>><i> wish I could help with this... if you get an answer please forward it this
</i>>><i> way. I'm super curious.
</i>>><i>
</i>>><i>
</i>>><i> On Fri, Jul 22, 2011 at 4:58 PM, Roberto Moutinho <
</i>>><i> <a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc">robertomoutinho at gmail.com</a>> wrote:
</i>>><i>
</i>>>><i> Hello to everyone,
</i>>>><i>
</i>>>><i> I've extended the C code on the
</i>>>><i> <a href="http://blog.dansingerman.com/post/4604532761/how-to-block-rate-limited-traffic-with-varnishpage...">http://blog.dansingerman.com/post/4604532761/how-to-block-rate-limited-traffic-with-varnishpage...</a>
</i>>>><i> But I have different needs from the original post since I'm serving a
</i>>>><i> protected content all the time (Restfull API).
</i>>>><i>
</i>>>><i> Basically I have to authenticate a api key (received within a special
</i>>>><i> header) on my database and store the key and theirs request limit value in
</i>>>><i> memached.
</i>>>><i>
</i>>>><i> My main problem is that my C code works perfect when using gcc (ubuntu)
</i>>>><i> to compile it but it does not compile together with Varnish.
</i>>>><i>
</i>>>><i> output from running varnishd
</i>>>><i> *
</i>>>><i> storage_malloc: max size 256 MB.
</i>>>><i> Message from C-compiler:
</i>>>><i> ./vcl.1P9zoqAU.c: In function ‘API’:
</i>>>><i> ./vcl.1P9zoqAU.c:602: error: invalid initializer
</i>>>><i> Running C-compiler failed, exit 1
</i>>>><i> VCL compilation failed*
</i>>>><i>
</i>>>><i> Searching for this "invalid initializer" on Google have not helped me at
</i>>>><i> all :(
</i>>>><i>
</i>>>><i> Best Regards
</i>>>><i> Roberto Moutinho
</i>>>><i>
</i>>>><i> _______________________________________________
</i>>>><i> varnish-misc mailing list
</i>>>><i> <a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc">varnish-misc at varnish-cache.org</a>
</i>>>><i> <a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc">https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc</a>
</i>>>><i>
</i>>><i>
</i>>><i>
</i>><i>
</i>><i> _______________________________________________
</i>><i> varnish-misc mailing list
</i>><i> <a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc">varnish-misc at varnish-cache.org</a>
</i>><i> <a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc">https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc</a>
</i>><i>
</i>-------------- next part --------------</pre></span>