[master] d26a828 Collapse Cookie headers in HTTP/2

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Fri Mar 31 14:25:08 CEST 2017


commit d26a828751ac8a49b04774a2014228de4e76205d
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Thu Mar 30 14:58:58 2017 +0200

    Collapse Cookie headers in HTTP/2
    
    Fixes #2291

diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index 3963625..aa8e1d7 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -1,6 +1,6 @@
 /*-
  * Copyright (c) 2006 Verdens Gang AS
- * Copyright (c) 2006-2015 Varnish Software AS
+ * Copyright (c) 2006-2017 Varnish Software AS
  * All rights reserved.
  *
  * Author: Poul-Henning Kamp <phk at phk.freebsd.dk>
@@ -799,6 +799,9 @@ cnt_recv(struct worker *wrk, struct req *req)
 
 	http_CollectHdr(req->http, H_Cache_Control);
 
+	if (req->http->protover == 20) // rfc7540,l,3114,3120
+		http_CollectHdrSep(req->http, H_Cookie, "; ");
+
 	if (req->req_body_status == REQ_BODY_FAIL) {
 		req->doclose = SC_OVERLOAD;
 		return (REQ_FSM_DONE);
diff --git a/bin/varnishtest/tests/r02291.vtc b/bin/varnishtest/tests/r02291.vtc
new file mode 100644
index 0000000..25659dd
--- /dev/null
+++ b/bin/varnishtest/tests/r02291.vtc
@@ -0,0 +1,33 @@
+varnishtest "Collect cookie headers in HTTP/2"
+
+server s1 -repeat 2 {
+	rxreq
+	txresp
+} -start
+
+varnish v1 -vcl+backend { } -start
+varnish v1 -cliok "param.set feature +http2"
+
+logexpect l1 -v v1 {
+	expect * * BereqProtocol	HTTP/1.1
+	expect * = BereqHeader		"Cookie: user=alice"
+	expect * = BereqHeader		"Cookie: peer=bob"
+	expect * * BereqProtocol	HTTP/2.0
+	expect * = BereqHeader		"cookie: user=alice;  peer=bob"
+} -start
+
+client c1 {
+	txreq -hdr "Cookie: user=alice" -hdr "Cookie: peer=bob"
+	rxresp
+	expect resp.status == 200
+} -run
+
+client c2 {
+	stream 1 {
+		txreq -hdr cookie user=alice -hdr cookie peer=bob
+		rxresp
+		expect resp.status == 200
+	} -run
+} -run
+
+logexpect l1 -wait



More information about the varnish-commit mailing list