[master] 72d1d4d77 Allow non-fatal (usually server) rxhdrs to fail silently, also when nothing has been received.

Poul-Henning Kamp phk at FreeBSD.org
Wed Feb 6 21:59:08 UTC 2019


commit 72d1d4d77d77913fcb5151bfe2b8203b21d59c19
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Feb 6 21:57:00 2019 +0000

    Allow non-fatal (usually server) rxhdrs to fail silently,
    also when nothing has been received.

diff --git a/bin/varnishtest/vtc_http.c b/bin/varnishtest/vtc_http.c
index 815dd8a11..0c136cfd1 100644
--- a/bin/varnishtest/vtc_http.c
+++ b/bin/varnishtest/vtc_http.c
@@ -420,6 +420,10 @@ http_splitheader(struct http *hp, int req)
 
 	n = 0;
 	p = hp->rxbuf;
+	if (*p == '\0') {
+		vtc_log(hp->vl, 4, "No headers");
+		return;
+	}
 
 	/* REQ/PROTO */
 	while (vct_islws(*p))
@@ -638,6 +642,7 @@ http_rxhdr(struct http *hp)
 
 	CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC);
 	hp->prxbuf = 0;
+	hp->rxbuf[0] = '\0';
 	hp->body = NULL;
 	bprintf(hp->bodylen, "%s", "<undef>");
 	while (1) {
@@ -654,11 +659,11 @@ http_rxhdr(struct http *hp)
 		if (i == 2 || !j)
 			break;
 	}
-	vtc_dump(hp->vl, 4, "rxhdr", hp->rxbuf, -1);
-	vtc_log(hp->vl, 4, "rxhdrlen = %zd", strlen(hp->rxbuf));
-	hp->body = hp->rxbuf + hp->prxbuf;
+	vtc_dump(hp->vl, 4, "rxhdr", hp->rxbuf, hp->prxbuf);
+	vtc_log(hp->vl, 4, "rxhdrlen = %d", hp->prxbuf);
 	if (!j)
-		vtc_fatal(hp->vl, "EOF timeout=%d", hp->timeout);
+		vtc_log(hp->vl, hp->fatal, "EOF timeout=%d", hp->timeout);
+	hp->body = hp->rxbuf + hp->prxbuf;
 }
 
 /* SECTION: client-server.spec.rxresp


More information about the varnish-commit mailing list