[master] 8204c7fc8 Don't try to receive body if we sent HEAD

Poul-Henning Kamp phk at FreeBSD.org
Wed Mar 6 10:44:08 UTC 2019


commit 8204c7fc844dcafe4d94a4d2c2254205a1e46d48
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Mar 6 10:39:07 2019 +0000

    Don't try to receive body if we sent HEAD
    
    Based on patch from @haproxyFred

diff --git a/bin/varnishtest/vtc_http.c b/bin/varnishtest/vtc_http.c
index 349eb596b..3e928cd49 100644
--- a/bin/varnishtest/vtc_http.c
+++ b/bin/varnishtest/vtc_http.c
@@ -708,7 +708,9 @@ cmd_http_rxresp(CMD_ARGS)
 		return;
 	if (!hp->resp[0] || !hp->resp[1])
 		return;
-	else if (!strcmp(hp->resp[1], "200"))
+	if (hp->head_method)
+		return;
+	if (!strcmp(hp->resp[1], "200"))
 		http_swallow_body(hp, hp->resp, 1, 0);
 	else
 		http_swallow_body(hp, hp->resp, 0, 0);
@@ -1282,6 +1284,7 @@ cmd_http_txreq(CMD_ARGS)
 			av++;
 		} else if (!strcmp(*av, "-req")) {
 			req = av[1];
+			hp->head_method = !strcasecmp(av[1], "HEAD") ;
 			av++;
 		} else if (!hp->sfd && !strcmp(*av, "-up")) {
 			up = av[1];
diff --git a/bin/varnishtest/vtc_http.h b/bin/varnishtest/vtc_http.h
index 6c857183f..4db97a82f 100644
--- a/bin/varnishtest/vtc_http.h
+++ b/bin/varnishtest/vtc_http.h
@@ -56,6 +56,8 @@ struct http {
 	int			gziplevel;
 	int			gzipresidual;
 
+	int			head_method;
+
 	int			fatal;
 
 	/* H/2 */


More information about the varnish-commit mailing list