<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<a class="moz-txt-link-freetext" href="https://www.varnish-cache.org/docs/3.0/reference/vmod_std.html">https://www.varnish-cache.org/docs/3.0/reference/vmod_std.html</a><br>
<br>
The std module provides a tolower function which is cleaner to use
in my honest opinion.<br>
Either way would work fine though. There really isn't a wrong way
to do it.<br>
<br>
~Paul<br>
<br>
<div class="moz-cite-prefix">On 9/30/2014 12:46 AM, Brice Burgess
wrote:<br>
</div>
<blockquote cite="mid:542A35B8.1000905@iceburg.net" type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
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>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
varnish-misc mailing list
<a class="moz-txt-link-abbreviated" href="mailto:varnish-misc@varnish-cache.org">varnish-misc@varnish-cache.org</a>
<a class="moz-txt-link-freetext" href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc">https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc</a></pre>
</blockquote>
<br>
</body>
</html>