r3498 - in trunk/varnish-cache/bin: varnishd varnishtest/tests

phk at projects.linpro.no phk at projects.linpro.no
Sat Jan 10 23:11:26 CET 2009


Author: phk
Date: 2009-01-10 23:11:26 +0100 (Sat, 10 Jan 2009)
New Revision: 3498

Added:
   trunk/varnish-cache/bin/varnishtest/tests/v00416.vtc
Modified:
   trunk/varnish-cache/bin/varnishd/cache_http.c
Log:
If we get more HTTP headers than we have room for (default: 28) we
used to ignore the rest.

This is not a bright solution if crucial HTTP headers like
"Content-Length" or "Transfer-Encoding" are last and get ignored.

In general, it is highly suspect to randomly ignore HTTP headers,
as opposed to deliberately ignoring them, either by having first
looked at them and found them uninteresting, or by having looked
for the headers we care about, and having not matched some others.

Change too many headers to firm error condition: 400 if from the
client, and 503 (like every other trouble) if from the backend.

Fixes #416



Modified: trunk/varnish-cache/bin/varnishd/cache_http.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_http.c	2008-12-21 18:42:48 UTC (rev 3497)
+++ trunk/varnish-cache/bin/varnishd/cache_http.c	2009-01-10 22:11:26 UTC (rev 3498)
@@ -354,6 +354,7 @@
 		} else {
 			VSL_stats->losthdr++;
 			WSL(w, SLT_LostHeader, fd, "%.*s", q - p, p);
+			return (400);
 		}
 	}
 	return (0);

Added: trunk/varnish-cache/bin/varnishtest/tests/v00416.vtc
===================================================================
--- trunk/varnish-cache/bin/varnishtest/tests/v00416.vtc	                        (rev 0)
+++ trunk/varnish-cache/bin/varnishtest/tests/v00416.vtc	2009-01-10 22:11:26 UTC (rev 3498)
@@ -0,0 +1,102 @@
+# $Id$
+
+test "Regression test for #416: a surplus of HTTP headers"
+
+server s1 {
+	rxreq
+	txresp \
+		-hdr hdr00=00 \
+		-hdr hdr01=01 \
+		-hdr hdr02=02 \
+		-hdr hdr03=03 \
+		-hdr hdr04=04 \
+		-hdr hdr05=05 \
+		-hdr hdr06=06 \
+		-hdr hdr07=07 \
+		-hdr hdr08=08 \
+		-hdr hdr09=09 \
+		-hdr hdr10=10 \
+		-hdr hdr11=11 \
+		-hdr hdr12=12 \
+		-hdr hdr13=13 \
+		-hdr hdr14=14 \
+		-hdr hdr15=15 \
+		-hdr hdr16=16 \
+		-hdr hdr17=17 \
+		-hdr hdr18=18 \
+		-hdr hdr19=19 \
+		-hdr hdr20=20 \
+		-hdr hdr21=21 \
+		-hdr hdr22=22 \
+		-hdr hdr23=23 \
+		-hdr hdr24=24 \
+		-hdr hdr25=25 \
+		-hdr hdr26=26 \
+		-hdr hdr27=27 \
+		-hdr hdr28=28 \
+		-hdr hdr29=29 \
+		-hdr hdr30=30 \
+		-hdr hdr31=31 \
+		-hdr hdr32=32 \
+		-hdr hdr33=33 \
+		-hdr hdr34=34 \
+		-hdr hdr35=35 \
+		-hdr hdr36=36 \
+		-hdr hdr37=37 \
+		-hdr hdr38=38 \
+		-hdr hdr39=39 \
+		-body "foo"
+} -start
+
+varnish v1 -vcl+backend {} -start
+
+client c1 {
+	txreq \
+		-hdr hdr00=00 \
+		-hdr hdr01=01 \
+		-hdr hdr02=02 \
+		-hdr hdr03=03 \
+		-hdr hdr04=04 \
+		-hdr hdr05=05 \
+		-hdr hdr06=06 \
+		-hdr hdr07=07 \
+		-hdr hdr08=08 \
+		-hdr hdr09=09 \
+		-hdr hdr10=10 \
+		-hdr hdr11=11 \
+		-hdr hdr12=12 \
+		-hdr hdr13=13 \
+		-hdr hdr14=14 \
+		-hdr hdr15=15 \
+		-hdr hdr16=16 \
+		-hdr hdr17=17 \
+		-hdr hdr18=18 \
+		-hdr hdr19=19 \
+		-hdr hdr20=20 \
+		-hdr hdr21=21 \
+		-hdr hdr22=22 \
+		-hdr hdr23=23 \
+		-hdr hdr24=24 \
+		-hdr hdr25=25 \
+		-hdr hdr26=26 \
+		-hdr hdr27=27 \
+		-hdr hdr28=28 \
+		-hdr hdr29=29 \
+		-hdr hdr30=30 \
+		-hdr hdr31=31 \
+		-hdr hdr32=32 \
+		-hdr hdr33=33 \
+		-hdr hdr34=34 \
+		-hdr hdr35=35 \
+		-hdr hdr36=36 \
+		-hdr hdr37=37 \
+		-hdr hdr38=38 \
+		-hdr hdr39=39
+	rxresp
+} -run
+
+client c1 {
+	txreq
+	rxresp
+	expect resp.status == 503
+} -run



More information about the varnish-commit mailing list