r3687 - in branches/2.0/varnish-cache/bin: varnishd varnishtest/tests

tfheen at projects.linpro.no tfheen at projects.linpro.no
Fri Feb 6 16:03:21 CET 2009


Author: tfheen
Date: 2009-02-06 16:03:21 +0100 (Fri, 06 Feb 2009)
New Revision: 3687

Added:
   branches/2.0/varnish-cache/bin/varnishtest/tests/v00416.vtc
Modified:
   branches/2.0/varnish-cache/bin/varnishd/cache_http.c
Log:
Merge r3498: Handle too many headers more gracefully

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: branches/2.0/varnish-cache/bin/varnishd/cache_http.c
===================================================================
--- branches/2.0/varnish-cache/bin/varnishd/cache_http.c	2009-02-06 14:58:26 UTC (rev 3686)
+++ branches/2.0/varnish-cache/bin/varnishd/cache_http.c	2009-02-06 15:03:21 UTC (rev 3687)
@@ -354,6 +354,7 @@
 		} else {
 			VSL_stats->losthdr++;
 			WSL(w, SLT_LostHeader, fd, "%.*s", q - p, p);
+			return (400);
 		}
 	}
 	return (0);

Copied: branches/2.0/varnish-cache/bin/varnishtest/tests/v00416.vtc (from rev 3498, trunk/varnish-cache/bin/varnishtest/tests/v00416.vtc)
===================================================================
--- branches/2.0/varnish-cache/bin/varnishtest/tests/v00416.vtc	                        (rev 0)
+++ branches/2.0/varnish-cache/bin/varnishtest/tests/v00416.vtc	2009-02-06 15:03:21 UTC (rev 3687)
@@ -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