[master] 0c5337e Change the response code on overly long request lines from 400 to 413 as per discussions in httpbis WG

Poul-Henning Kamp phk at varnish-cache.org
Mon Jul 18 12:33:14 CEST 2011


commit 0c5337e2732a94c68cb4161c47f9aaf63d4e6e3c
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Jul 18 10:32:45 2011 +0000

    Change the response code on overly long request lines from 400 to 413
    as per discussions in httpbis WG

diff --git a/bin/varnishd/cache_http.c b/bin/varnishd/cache_http.c
index 5d8050a..15d1b52 100644
--- a/bin/varnishd/cache_http.c
+++ b/bin/varnishd/cache_http.c
@@ -522,7 +522,7 @@ http_dissect_hdrs(struct worker *w, struct http *hp, int fd, char *p,
 		if (q - p > htc->maxhdr) {
 			VSC_C_main->losthdr++;
 			WSL(w, SLT_LostHeader, fd, "%.*s", q - p, p);
-			return (400);
+			return (413);
 		}
 
 		/* Empty header = end of headers */
@@ -547,7 +547,7 @@ http_dissect_hdrs(struct worker *w, struct http *hp, int fd, char *p,
 		} else {
 			VSC_C_main->losthdr++;
 			WSL(w, SLT_LostHeader, fd, "%.*s", q - p, p);
-			return (400);
+			return (413);
 		}
 	}
 	return (0);
@@ -598,7 +598,7 @@ http_splitline(struct worker *w, int fd, struct http *hp,
 	hp->hd[h2].e = p;
 
 	if (!Tlen(hp->hd[h2]))
-		return (400);
+		return (413);
 
 	/* Skip SP */
 	for (; vct_issp(*p); p++) {
diff --git a/bin/varnishtest/tests/c00039.vtc b/bin/varnishtest/tests/c00039.vtc
index f8bba06..9339b59 100644
--- a/bin/varnishtest/tests/c00039.vtc
+++ b/bin/varnishtest/tests/c00039.vtc
@@ -23,7 +23,7 @@ client c1 {
 	expect resp.status == 200
 	txreq -url "/1" -hdr "1...5....0....5....0....5....0....5....0."
 	rxresp
-	expect resp.status == 400
+	expect resp.status == 413
 } -run
 
 client c1 {
@@ -32,7 +32,7 @@ client c1 {
 	expect resp.status == 200
 	txreq -url "/2" -hdr "1...5....0....5\n ..0....5....0....5....0."
 	rxresp
-	expect resp.status == 400
+	expect resp.status == 413
 } -run
 
 client c1 {



More information about the varnish-commit mailing list