Patch proposal: handling multiple Set-Cookie headers from backend

Poul-Henning Kamp phk at phk.freebsd.dk
Tue Mar 22 17:16:32 CET 2011


In message <4A029B1A60B8E340A50D654D2F130DAA2FCEA3AA18 at EXCV001.encara.local.ads
>, "MAGNIEN, Thierry" writes:

>I had a look into the source code and it seemed to me that the
>following patch would be enough to get it working. However, I find
>it so simple that I'm afraid I missed something ;-)

You did :-)

There is a vmod_std function for doing this in -trunk now.

	import std from ...

	sub vcl_fetch {
		std.collect(resp.http.set-cookie);
	}

I'm still hoping that we'll find time/hands to produce a vmod_cookie
which would give a sensible API, so people can clearly express
what they want:

	import cookie from ...

	sub vcl_recv {
		cookie.keep_only("This_cookie", "That_cookie");
		if (cookie.get("This_cookie") == "mumblemumble") {
			...
		}
	}

	sub vcl_fetch {
		cookie.keep_only("This_cookie", "That_cookie");
	}



-- 
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-dev mailing list