[master] 341fd85 Back to Expect handling according to rfc7231

Nils Goroll nils.goroll at uplex.de
Mon Feb 27 10:30:07 CET 2017


commit 341fd85259c26fbca6a6c1ded85f85184d8069f4
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Mon Feb 27 10:21:17 2017 +0100

    Back to Expect handling according to rfc7231
    
    Revert a regressive nit from bdd84ffc5300c25ca8c13b3aefa71e05cad99d26 which
    has nothing to do with H/2
    
    https://tools.ietf.org/html/rfc7231#section-5.1.1
    
       Requirements for servers:
    
       o  A server that receives a 100-continue expectation in an HTTP/1.0
          request MUST ignore that expectation.
    
    So if Expect exists but is not "100-continue", we send the 417 irrespective
    of the protocol version.
    
    But if is is 100-continue and the protocol is HTTP/1.0 or below, we ignore
    the header.

diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index 54df7c4..cb9a545 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -66,14 +66,14 @@ CNT_GotReq(struct worker *wrk, struct req *req)
 	AN(req->transport->minimal_response);
 
 	if (http_GetHdr(req->http, H_Expect, &p)) {
-		if (strcasecmp(p, "100-continue") ||
-		    req->http->protover < 11) {
+		if (strcasecmp(p, "100-continue")) {
 			req->doclose = SC_RX_JUNK;
 			(void)req->transport->minimal_response(req, 417);
 			wrk->stats->client_req_417++;
 			return (-1);
 		}
-		if (req->htc->pipeline_b == NULL)	// XXX: HTTP1 vs 2 ?
+		if (req->http->protover >= 11 &&
+		    req->htc->pipeline_b == NULL)	// XXX: HTTP1 vs 2 ?
 			req->want100cont = 1;
 		http_Unset(req->http, H_Expect);
 	}



More information about the varnish-commit mailing list