r1888 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Mon Aug 20 13:05:08 CEST 2007


Author: phk
Date: 2007-08-20 13:05:07 +0200 (Mon, 20 Aug 2007)
New Revision: 1888

Modified:
   trunk/varnish-cache/bin/varnishd/cache_http.c
Log:
Fix a long-standing bug in pipe-mode:  We must pass the protocol version
across unchanged, otherwise the semantics of the Connection: header cannot
be interpreted correctly by the server.

wget(1) could trigger this problem and would have to wait for the server
to close the (seemingly idle) connection before continuing.



Modified: trunk/varnish-cache/bin/varnishd/cache_http.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_http.c	2007-08-20 11:02:27 UTC (rev 1887)
+++ trunk/varnish-cache/bin/varnishd/cache_http.c	2007-08-20 11:05:07 UTC (rev 1888)
@@ -701,17 +701,20 @@
 }
 
 static void
-http_copyreq(struct http *to, struct http *fm, int forceget)
+http_copyreq(struct http *to, struct http *fm, int transparent)
 {
 
 	CHECK_OBJ_NOTNULL(fm, HTTP_MAGIC);
 	CHECK_OBJ_NOTNULL(to, HTTP_MAGIC);
-	if (forceget)
+	if (transparent)
+		http_copyh(to, fm, HTTP_HDR_REQ);
+	else
 		http_SetH(to, HTTP_HDR_REQ, "GET");
+	http_copyh(to, fm, HTTP_HDR_URL);
+	if (transparent)
+		http_copyh(to, fm, HTTP_HDR_PROTO);
 	else
-		http_copyh(to, fm, HTTP_HDR_REQ);
-	http_copyh(to, fm, HTTP_HDR_URL);
-	http_SetH(to, HTTP_HDR_PROTO, "HTTP/1.1");
+		http_SetH(to, HTTP_HDR_PROTO, "HTTP/1.1");
 }
 
 void
@@ -792,7 +795,7 @@
         hp = bereq->http;
         hp->logtag = HTTP_Tx;
 
-	http_copyreq(hp, sp->http, how != HTTPH_R_PIPE);
+	http_copyreq(hp, sp->http, how == HTTPH_R_PIPE);
 	http_FilterFields(sp->wrk, sp->fd, hp, sp->http, how);
 	http_PrintfHeader(sp->wrk, sp->fd, hp, "X-Varnish: %u", sp->xid);
 	http_PrintfHeader(sp->wrk, sp->fd, hp,




More information about the varnish-commit mailing list