[master] 70ba8e0 Send 100-continue after vcl_recv or when caching the request body

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


commit 70ba8e03d8f2ba9986756abb5cc6fb50857dbea5
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Thu Feb 23 17:44:35 2017 +0100

    Send 100-continue after vcl_recv or when caching the request body
    
    whichever comes first

diff --git a/bin/varnishd/cache/cache_req_body.c b/bin/varnishd/cache/cache_req_body.c
index 275260f..2036094 100644
--- a/bin/varnishd/cache/cache_req_body.c
+++ b/bin/varnishd/cache/cache_req_body.c
@@ -37,6 +37,7 @@
 #include "vtim.h"
 #include "hash/hash_slinger.h"
 #include "storage/storage.h"
+#include "cache_transport.h"
 
 /*----------------------------------------------------------------------
  * Pull the req.body in via/into a objcore
@@ -84,6 +85,10 @@ vrb_pull(struct req *req, ssize_t maxsize, objiterate_f *func, void *priv)
 	AZ(req->req_bodybytes);
 	AN(req->htc);
 	yet = req->htc->content_length;
+	if (yet != 0 && req->want100cont) {
+		req->want100cont = 0;
+		(void) req->transport->minimal_response(req, 100);
+	}
 	if (yet < 0)
 		yet = 0;
 	do {
diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index 0e9b72f..821a1e7 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -747,6 +747,12 @@ cnt_recv(struct worker *wrk, struct req *req)
 		VCL_recv_method(req->vcl, wrk, req, NULL, NULL);
 	}
 
+	if (req->want100cont) {
+		req->want100cont = 0;
+		if (req->transport->minimal_response(req, 100))
+			return (-1);
+	}
+
 	/* Attempts to cache req.body may fail */
 	if (req->req_body_status == REQ_BODY_FAIL) {
 		req->doclose = SC_RX_BODY;
diff --git a/bin/varnishd/http1/cache_http1_fsm.c b/bin/varnishd/http1/cache_http1_fsm.c
index 1dfe146..faad72e 100644
--- a/bin/varnishd/http1/cache_http1_fsm.c
+++ b/bin/varnishd/http1/cache_http1_fsm.c
@@ -328,9 +328,7 @@ http1_dissect(struct worker *wrk, struct req *req)
 			wrk->stats->client_req_417++;
 			return (-1);
 		}
-		http1_simple_response(req, R_100);
-		if (req->doclose)
-			return (-1);
+		req->want100cont = 1;
 		http_Unset(req->http, H_Expect);
 	}
 
diff --git a/include/tbl/req_flags.h b/include/tbl/req_flags.h
index f743649..fba8943 100644
--- a/include/tbl/req_flags.h
+++ b/include/tbl/req_flags.h
@@ -35,6 +35,7 @@ REQ_FLAG(hash_ignore_busy,	1, 1, "")
 REQ_FLAG(hash_always_miss,	1, 1, "")
 REQ_FLAG(is_hit,		0, 0, "")
 REQ_FLAG(waitinglist,		0, 0, "")
+REQ_FLAG(want100cont,		0, 0, "")
 #undef REQ_FLAG
 
 /*lint -restore */



More information about the varnish-commit mailing list