[master] 81c29c6 be picky about headers not being set to NULL after the request/status line

Nils Goroll nils.goroll at uplex.de
Mon Jun 27 14:25:08 CEST 2016


commit 81c29c62256e617b8071df7b8b11c131d361e034
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Mon Jun 27 13:58:21 2016 +0200

    be picky about headers not being set to NULL after the request/status line
    
    Relates to #1990

diff --git a/bin/varnishd/cache/cache_http.c b/bin/varnishd/cache/cache_http.c
index d52b9fb..3efd78a 100644
--- a/bin/varnishd/cache/cache_http.c
+++ b/bin/varnishd/cache/cache_http.c
@@ -1031,8 +1031,7 @@ http_filterfields(struct http *to, const struct http *fm, unsigned how)
 	to->nhd = HTTP_HDR_FIRST;
 	to->status = fm->status;
 	for (u = HTTP_HDR_FIRST; u < fm->nhd; u++) {
-		if (fm->hd[u].b == NULL)
-			continue;
+		Tcheck(fm->hd[u]);
 		if (fm->hdf[u] & HDF_FILTER)
 			continue;
 		Tcheck(fm->hd[u]);
@@ -1088,8 +1087,10 @@ http_CopyHome(const struct http *hp)
 	char *p;
 
 	for (u = 0; u < hp->nhd; u++) {
-		if (hp->hd[u].b == NULL)
+		if (hp->hd[u].b == NULL) {
+			assert(u < HTTP_HDR_FIRST);
 			continue;
+		}
 		if (hp->hd[u].b >= hp->ws->s && hp->hd[u].e <= hp->ws->e)
 			continue;
 
@@ -1187,8 +1188,7 @@ http_Unset(struct http *hp, const char *hdr)
 	uint16_t u, v;
 
 	for (v = u = HTTP_HDR_FIRST; u < hp->nhd; u++) {
-		if (hp->hd[u].b == NULL)
-			continue;
+		Tcheck(hp->hd[u]);
 		if (http_IsHdr(&hp->hd[u], hdr)) {
 			http_VSLH_del(hp, u);
 			continue;



More information about the varnish-commit mailing list