<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi,<br>
<br>
The varnish-4 Hashing documentation states; "It is worth pointing
out that Varnish doesn't lowercase the
hostname or the URL before hashing it so in theory having
"Varnish.org/"
and "varnish.org/" would result in different cache entries."<br>
<br>
I would like to lowercase both the host and url during my
normalization routines in vcl_recv. Stackoverflow has an example
using embedded C;<br>
<br>
===<br>
<pre style="" class="lang-c prettyprint prettyprinted"><code><span class="pln">C</span><span class="pun">{</span><span class="pln">
</span><span class="com">#include</span><span class="pln"> </span><span class="str"><ctype.h></span><span class="pln"></span><span class="com"></span><span class="pln">
</span><span class="kwd">static</span><span class="pln"> </span><span class="kwd">void</span><span class="pln"> strtolower</span><span class="pun">(</span><span class="kwd">const</span><span class="pln"> </span><span class="kwd">char</span><span class="pln"> </span><span class="pun">*</span><span class="pln">s</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
</span><span class="kwd">register</span><span class="pln"> </span><span class="kwd">char</span><span class="pln"> </span><span class="pun">*</span><span class="pln">c</span><span class="pun">;</span><span class="pln">
</span><span class="kwd">for</span><span class="pln"> </span><span class="pun">(</span><span class="pln">c</span><span class="pun">=</span><span class="pln">s</span><span class="pun">;</span><span class="pln"> </span><span class="pun">*</span><span class="pln">c</span><span class="pun">;</span><span class="pln"> c</span><span class="pun">++)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
</span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">isupper</span><span class="pun">(*</span><span class="pln">c</span><span class="pun">))</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
</span><span class="pun">*</span><span class="pln">c </span><span class="pun">=</span><span class="pln"> tolower</span><span class="pun">(*</span><span class="pln">c</span><span class="pun">);</span><span class="pln">
</span><span class="pun">}</span><span class="pln">
</span><span class="pun">}</span><span class="pln">
</span><span class="kwd">return</span><span class="pun">;</span><span class="pln">
</span><span class="pun">}</span><span class="pln">
</span><span class="pun">}</span><span class="pln">C
sub vcl_recv </span><span class="pun">{</span><span class="pln">
C</span><span class="pun">{</span><span class="pln">
strtolower</span><span class="pun">(</span><span class="pln">VRT_r_req_url</span><span class="pun">(</span><span class="pln">sp</span><span class="pun">));</span><span class="pln">
</span><span class="pun">}</span><span class="pln">C
</span><span class="pun">}
===
Is this the recommended approach -- and will it work with the variable definition changes in varnish 4? (I'm worried </span></code><code><span class="pln">VRT_r_req_url</span></code>(sp) may break).
Also -- what is the variable holding the Host string? Is VRT_r_req_host(sp) valid in varnish-4?
Many thanks,
~ Brice
</pre>
<br>
</body>
</html>