[master] deb3ef1 Fix a couple of bugs for the detached rx*body functions.

Poul-Henning Kamp phk at FreeBSD.org
Thu Oct 30 16:50:21 CET 2014


commit deb3ef1029c4388720ee0dc579cdb4e81a0357d3
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Thu Oct 30 15:49:39 2014 +0000

    Fix a couple of bugs for the detached rx*body functions.

diff --git a/bin/varnishtest/vtc_http.c b/bin/varnishtest/vtc_http.c
index 6de14ea..a3dbff4 100644
--- a/bin/varnishtest/vtc_http.c
+++ b/bin/varnishtest/vtc_http.c
@@ -465,10 +465,10 @@ http_swallow_body(struct http *hp, char * const *hh, int body)
 	char *p;
 	int i, l, ll;
 
+	hp->body = hp->rxbuf + hp->prxbuf;
 	ll = 0;
 	p = http_find_header(hh, "content-length");
 	if (p != NULL) {
-		hp->body = hp->rxbuf + hp->prxbuf;
 		l = strtoul(p, NULL, 10);
 		(void)http_rxchar(hp, l, 0);
 		vtc_dump(hp->vl, 4, "body", hp->body, l);
@@ -487,7 +487,6 @@ http_swallow_body(struct http *hp, char * const *hh, int body)
 		return;
 	}
 	if (body) {
-		hp->body = hp->rxbuf + hp->prxbuf;
 		do  {
 			i = http_rxchar(hp, 1, 1);
 			ll += i;
@@ -558,7 +557,6 @@ cmd_http_rxresp(CMD_ARGS)
 	if (http_count_header(hp->resp, "Content-Length") > 1)
 		vtc_log(hp->vl, 0,
 		    "Multiple Content-Length headers.\n");
-	hp->body = hp->rxbuf + hp->prxbuf;
 	if (!has_obj)
 		return;
 	else if (!strcmp(hp->resp[1], "200"))
@@ -848,7 +846,6 @@ cmd_http_rxreq(CMD_ARGS)
 	if (http_count_header(hp->req, "Content-Length") > 1)
 		vtc_log(hp->vl, 0,
 		    "Multiple Content-Length headers.\n");
-	hp->body = hp->rxbuf + hp->prxbuf;
 	http_swallow_body(hp, hp->req, 0);
 	vtc_log(hp->vl, 4, "bodylen = %s", hp->bodylen);
 }



More information about the varnish-commit mailing list