Hi Paul,<div><br></div><div>Thank you for your answer, and your idea. It is a very good idea I didn't think of. </div><div><br></div><div>I don't know if it's gonna be the solution I'll adopt, but at this very moment I only have that or coding a vmod. However I don't think that coding a vmod is a solution as I would just implement something (regular expression evaluation at run time) that phk says being too expensive.</div>
<div><br></div><div>-Hugues</div><div><br><div class="gmail_quote">On Wed, Oct 10, 2012 at 3:59 PM, Paul A. Procacci <span dir="ltr"><<a href="mailto:pprocacci@datapipe.com" target="_blank">pprocacci@datapipe.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Everything you stated is true.  Without inline C or a vmod<br>
the only alternative I know of to accomplish this would be<br>
to dynamically generate the parts of your config that<br>
depend on the sha1 of a url.<br>
<br>
For instance, you could use something similar to the following:<br>
<br>
#################################################<br>
#!/usr/bin/perl -w<br>
<br>
use strict;<br>
use Digest::SHA qw(sha1_hex);<br>
<br>
my @files = qw!/index.html /homepage.html!;<br>
<br>
my $output;<br>
my $seen = 0;<br>
foreach(@files){<br>
  if($seen++){<br>
    $output .= "else";<br>
  }<br>
  $output .= "if(req.url == \"$_\"){\n";<br>
  $output .= "  set resp.http.Set-Cookie = \"foo" . sha1_hex($_) . "=\" + random.get_rand();\n";<br>
  $output .= "}\n"<br>
}<br>
<br>
print $output;<br>
#################################################<br>
<br>
Modified to your liking obviously, which results in the following<br>
output:<br>
<br>
#################################################<br>
if(req.url == "/index.html"){<br>
  set resp.http.Set-Cookie = "foo14fe4559026d4c5b5eb530ee70300c52d99e70d7=" + random.get_rand();<br>
}<br>
elseif(req.url == "/homepage.html"){<br>
  set resp.http.Set-Cookie = "foo6593125bb8fade312b1081d4ee1998f316aa4081=" + random.get_rand();<br>
}<br>
#################################################<br>
<br>
This has the benefit that everything with exception to the random<br>
number is computed ahead of time, but has the drawback of having<br>
to use in this case, another script to maintain a list of<br>
accessible files to generate their hash.<br>
<br>
Honestly not sure if this is going to help or not, but<br>
maybe it'll give you other ideas to explore.<br>
<br>
~Paul<br>
<br>
________________________________<br>
<br>
This message may contain confidential or privileged information. If you are not the intended recipient, please advise us immediately and delete this message. See <a href="http://www.datapipe.com/legal/email_disclaimer/" target="_blank">http://www.datapipe.com/legal/email_disclaimer/</a> for further information on confidentiality and the risks of non-secure electronic communication. If you cannot access these links, please notify us by reply message and we will send the contents to you.<br>

</blockquote></div><br><br clear="all"><div><br></div>-- <br>Hugues ALARY<br>
</div>