r4325 - in branches/2.0/varnish-cache/bin: varnishd varnishtest/tests
tfheen at projects.linpro.no
tfheen at projects.linpro.no
Tue Oct 13 11:05:12 CEST 2009
Author: tfheen
Date: 2009-10-13 11:05:12 +0200 (Tue, 13 Oct 2009)
New Revision: 4325
Added:
branches/2.0/varnish-cache/bin/varnishtest/tests/r00561.vtc
Removed:
branches/2.0/varnish-cache/bin/varnishtest/tests/r00354.vtc
Modified:
branches/2.0/varnish-cache/bin/varnishd/cache_center.c
branches/2.0/varnish-cache/bin/varnishd/cache_http.c
Log:
Merge r4263: Reject garbled requests
If we cannot even make sense of the request, don't bother with
attempting a reply.
Fixes #561
Modified: branches/2.0/varnish-cache/bin/varnishd/cache_center.c
===================================================================
--- branches/2.0/varnish-cache/bin/varnishd/cache_center.c 2009-10-13 08:43:42 UTC (rev 4324)
+++ branches/2.0/varnish-cache/bin/varnishd/cache_center.c 2009-10-13 09:05:12 UTC (rev 4325)
@@ -905,6 +905,13 @@
http_Setup(sp->http, sp->ws);
done = http_DissectRequest(sp);
+ /* If we could not even parse the request, just close */
+ if (done < 0) {
+ sp->step = STP_DONE;
+ vca_close_session(sp, "junk");
+ return (0);
+ }
+
/* Catch request snapshot */
sp->ws_req = WS_Snapshot(sp->ws);
Modified: branches/2.0/varnish-cache/bin/varnishd/cache_http.c
===================================================================
--- branches/2.0/varnish-cache/bin/varnishd/cache_http.c 2009-10-13 08:43:42 UTC (rev 4324)
+++ branches/2.0/varnish-cache/bin/varnishd/cache_http.c 2009-10-13 09:05:12 UTC (rev 4325)
@@ -406,7 +406,7 @@
q = p;
for (; !vct_issp(*p); p++) {
if (vct_isctl(*p))
- return (400);
+ return (-1);
}
hp->hd[h1].b = q;
hp->hd[h1].e = p;
@@ -414,14 +414,14 @@
/* Skip SP */
for (; vct_issp(*p); p++) {
if (vct_isctl(*p))
- return (400);
+ return (-1);
}
/* Second field cannot contain LWS or CTL */
q = p;
for (; !vct_islws(*p); p++) {
if (vct_isctl(*p))
- return (400);
+ return (-1);
}
hp->hd[h2].b = q;
hp->hd[h2].e = p;
@@ -432,7 +432,7 @@
/* Skip SP */
for (; vct_issp(*p); p++) {
if (vct_isctl(*p))
- return (400);
+ return (-1);
}
/* Third field is optional and cannot contain CTL */
@@ -440,7 +440,7 @@
if (!vct_iscrlf(*p)) {
for (; !vct_iscrlf(*p); p++)
if (vct_isctl(*p))
- return (400);
+ return (-1);
}
hp->hd[h3].b = q;
hp->hd[h3].e = p;
Deleted: branches/2.0/varnish-cache/bin/varnishtest/tests/r00354.vtc
===================================================================
--- branches/2.0/varnish-cache/bin/varnishtest/tests/r00354.vtc 2009-10-13 08:43:42 UTC (rev 4324)
+++ branches/2.0/varnish-cache/bin/varnishtest/tests/r00354.vtc 2009-10-13 09:05:12 UTC (rev 4325)
@@ -1,16 +0,0 @@
-# $Id$
-
-test "#354 Segfault in strcmp in http_DissectRequest()"
-
-server s1 {
- rxreq
- txresp
-}
-
-varnish v1 -vcl+backend {} -start
-
-client c1 {
- send "FOO\r\n\r\n"
- rxresp
- expect resp.status == 400
-} -run
Copied: branches/2.0/varnish-cache/bin/varnishtest/tests/r00561.vtc (from rev 4263, trunk/varnish-cache/bin/varnishtest/tests/r00561.vtc)
===================================================================
--- branches/2.0/varnish-cache/bin/varnishtest/tests/r00561.vtc (rev 0)
+++ branches/2.0/varnish-cache/bin/varnishtest/tests/r00561.vtc 2009-10-13 09:05:12 UTC (rev 4325)
@@ -0,0 +1,25 @@
+# $Id$
+
+test "Junk request should not go to vcl_error"
+
+server s1 {
+ rxreq
+ txresp
+} -start
+
+varnish v1 -vcl+backend {
+ sub vcl_error {
+ return (restart);
+ }
+} -start
+
+client c1 {
+ send "sljdslf\r\n\r\n"
+ delay .1
+} -run
+
+client c1 {
+ txreq
+ rxresp
+} -run
+
More information about the varnish-commit
mailing list