[master] 260d0ecc5 Report what we did get, if we EOF while receiving header.

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


commit 260d0ecc5b4b9702f6d53cd2a6854c373384ea51
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Feb 6 20:57:49 2019 +0000

    Report what we did get, if we EOF while receiving header.

diff --git a/bin/varnishtest/vtc_http.c b/bin/varnishtest/vtc_http.c
index a8461530d..815dd8a11 100644
--- a/bin/varnishtest/vtc_http.c
+++ b/bin/varnishtest/vtc_http.c
@@ -633,7 +633,7 @@ http_swallow_body(struct http *hp, char * const *hh, int body)
 static void
 http_rxhdr(struct http *hp)
 {
-	int i;
+	int i, j;
 	char *p;
 
 	CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC);
@@ -641,7 +641,7 @@ http_rxhdr(struct http *hp)
 	hp->body = NULL;
 	bprintf(hp->bodylen, "%s", "<undef>");
 	while (1) {
-		(void)http_rxchar(hp, 1, 0);
+		j = http_rxchar(hp, 1, 1);
 		p = hp->rxbuf + hp->prxbuf - 1;
 		for (i = 0; p > hp->rxbuf; p--) {
 			if (*p != '\n')
@@ -651,12 +651,14 @@ http_rxhdr(struct http *hp)
 			if (++i == 2)
 				break;
 		}
-		if (i == 2)
+		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;
+	if (!j)
+		vtc_fatal(hp->vl, "EOF timeout=%d", hp->timeout);
 }
 
 /* SECTION: client-server.spec.rxresp


More information about the varnish-commit mailing list