]> err.no Git - varnish/commitdiff
If we get more HTTP headers than we have room for (default: 28) we
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Sat, 10 Jan 2009 22:11:26 +0000 (22:11 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Sat, 10 Jan 2009 22:11:26 +0000 (22:11 +0000)
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

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3498 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/cache_http.c
varnish-cache/bin/varnishtest/tests/v00416.vtc [new file with mode: 0644]

index fbafdbdb4a3ff75a1196bb8975e065429f7af9a4..19d29cd2499fde41b7bbd72c691fcbef8e21992b 100644 (file)
@@ -354,6 +354,7 @@ http_dissect_hdrs(struct worker *w, struct http *hp, int fd, char *p, txt t)
                } else {
                        VSL_stats->losthdr++;
                        WSL(w, SLT_LostHeader, fd, "%.*s", q - p, p);
+                       return (400);
                }
        }
        return (0);
diff --git a/varnish-cache/bin/varnishtest/tests/v00416.vtc b/varnish-cache/bin/varnishtest/tests/v00416.vtc
new file mode 100644 (file)
index 0000000..547da93
--- /dev/null
@@ -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