[master] 89d330190 Make truncated HTTP headers failure by default subject to "non_fatal"

Poul-Henning Kamp phk at FreeBSD.org
Mon Apr 29 10:25:08 UTC 2019


commit 89d33019022a8ed81a9cbe5aef86b5ea8ac17c0f
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Apr 29 10:20:22 2019 +0000

    Make truncated HTTP headers failure by default subject to "non_fatal"

diff --git a/bin/varnishtest/vtc_http.c b/bin/varnishtest/vtc_http.c
index d4e03999f..6e249ae24 100644
--- a/bin/varnishtest/vtc_http.c
+++ b/bin/varnishtest/vtc_http.c
@@ -467,11 +467,15 @@ http_splitheader(struct http *hp, int req)
 		hh[n++] = p++;
 		while (*p != '\0' && !vct_iscrlf(p))
 			p++;
+		if (*p == '\0') {
+			break;
+		}
 		q = p;
 		p += vct_skipcrlf(p);
 		*q = '\0';
 	}
-	p += vct_skipcrlf(p);
+	if (*p != '\0')
+		p += vct_skipcrlf(p);
 	assert(*p == '\0');
 
 	for (n = 0; n < 3 || hh[n] != NULL; n++) {
@@ -670,6 +674,9 @@ http_rxhdr(struct http *hp)
 	l = hp->rx_p - hp->rx_b;
 	vtc_dump(hp->vl, 4, "rxhdr", hp->rx_b, l);
 	vtc_log(hp->vl, 4, "rxhdrlen = %zd", l);
+	if (i < 1)
+		vtc_log(hp->vl, hp->fatal, "HTTP header is incomplete");
+	*hp->rx_p = '\0';
 	hp->body = hp->rx_p;
 }
 


More information about the varnish-commit mailing list