varnish & cookies & multilanguage

Poul-Henning Kamp phk at phk.freebsd.dk
Thu Aug 2 18:49:00 CEST 2007


In message <8e6064260708020912ld274f18n7fea9f636dd6a31 at mail.gmail.com>, rafailowski writes:
>It doesn't work with this:
>
>sub vcl_hash {
>        if (req.http.cookie) {
>                set req.hash += regsub(
>                req.http.cookie,
>                ".*LOCALIZER_LANGUAGE=%22(..)%22.*",
>                "$1");
>        }
>}
>
>So i investiguate the logs and i found this, it seems that it crash
>the process childs.

It's not the %22 that causes the crash, it is a memory management
issue, and I don't have a 4 minute fix right now, I've opened a
ticket and will look at it.

You may be able to work around this for now by doing the substitution
into a pseudo header in vcl_recv and use that in vcl_hash, something like:

sub vcl_recv {
	[...]
        if (req.http.cookie ~ LOCALIZER_LANGUAGE) {
                set req.http.mylang = regsub(
			req.http.cookie,
			".*LOCALIZER_LANGUAGE=%22(..)%22.*",
			"$1");
		lookup;
        }
	[...]
}


sub vcl_hash {
	set req.hash += req.http.mylang;
}



-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.



More information about the varnish-misc mailing list