lowercasing request - varnish 4
Paul Procacci
pprocacci at datapipe.com
Tue Sep 30 20:18:58 CEST 2014
https://www.varnish-cache.org/docs/3.0/reference/vmod_std.html
The std module provides a tolower function which is cleaner to use in my
honest opinion.
Either way would work fine though. There really isn't a wrong way to do it.
~Paul
On 9/30/2014 12:46 AM, Brice Burgess wrote:
> Hi,
>
> 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."
>
> I would like to lowercase both the host and url during my
> normalization routines in vcl_recv. Stackoverflow has an example using
> embedded C;
>
> ===
> |C{
> #include <ctype.h>
> static void strtolower(const char *s) {
> register char *c;
> for (c=s; *c; c++) {
> if (isupper(*c)) {
> *c= tolower(*c);
> }
> }
> return;
> }
> }C
>
> sub vcl_recv{
> C{
> strtolower(VRT_r_req_url(sp));
> }C
> }
> ===
>
> Is this the recommended approach -- and will it work with the variable definition changes in varnish 4? (I'm worried||VRT_r_req_url|(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
>
>
>
>
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20140930/16f73ee2/attachment.html>
More information about the varnish-misc
mailing list