[master] 5af2605 Fix cases when we do not want to send a 100 Continue

Nils Goroll nils.goroll at uplex.de
Thu Feb 23 17:46:05 CET 2017


commit 5af2605607a28f62efbc70203f65cc5fb154fbdc
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Thu Feb 23 17:44:39 2017 +0100

    Fix cases when we do not want to send a 100 Continue
    
    - when we already started reading the body
    - for HTTP Versions less than 1.1

diff --git a/bin/varnishd/http1/cache_http1_fsm.c b/bin/varnishd/http1/cache_http1_fsm.c
index faad72e..b880367 100644
--- a/bin/varnishd/http1/cache_http1_fsm.c
+++ b/bin/varnishd/http1/cache_http1_fsm.c
@@ -328,7 +328,8 @@ http1_dissect(struct worker *wrk, struct req *req)
 			wrk->stats->client_req_417++;
 			return (-1);
 		}
-		req->want100cont = 1;
+		if (req->http->protover >= 11 && req->htc->pipeline_b == NULL)
+			req->want100cont = 1;
 		http_Unset(req->http, H_Expect);
 	}
 
diff --git a/bin/varnishtest/tests/c00018.vtc b/bin/varnishtest/tests/c00018.vtc
index 4351748..d5fc0e6 100644
--- a/bin/varnishtest/tests/c00018.vtc
+++ b/bin/varnishtest/tests/c00018.vtc
@@ -1,18 +1,27 @@
-varnishtest "Check Expect headers"
+varnishtest "Check Expect headers / 100 Continue"
 
 server s1 {
 	rxreq
 	txresp
+	rxreq
+	txresp
 } -start
 
 varnish v1 -vcl+backend { } -start
 
 client c1 {
-	txreq -url "/" -req POST -hdr "Expect: 100-continue " -body "foo"
+	txreq -url "/" -req POST -hdr "Expect: 100-continue " \
+		-hdr "Content-Length: 20"
 	rxresp
 	expect resp.status == 100
+	send "01234567890123456789"
+	rxresp
+	expect resp.status == 200
+
+	txreq -url "/" -req POST -hdr "Expect: 100-continue " -body "foo"
 	rxresp
 	expect resp.status == 200
+
 	txreq -url "/" -req POST -hdr "Expect: 101-continue" -body "foo"
 	rxresp
 	expect resp.status == 417



More information about the varnish-commit mailing list