r1622 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Tue Jul 3 10:50:35 CEST 2007


Author: phk
Date: 2007-07-03 10:50:34 +0200 (Tue, 03 Jul 2007)
New Revision: 1622

Modified:
   trunk/varnish-cache/bin/varnishd/cache.h
   trunk/varnish-cache/bin/varnishd/cache_pipe.c
Log:
Convert pipe mode to use the bereq in struct worker.

(See architect notes on wiki for reasoning)


Modified: trunk/varnish-cache/bin/varnishd/cache.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache.h	2007-07-03 08:11:17 UTC (rev 1621)
+++ trunk/varnish-cache/bin/varnishd/cache.h	2007-07-03 08:50:34 UTC (rev 1622)
@@ -165,9 +165,14 @@
 	struct VCL_conf		*vcl;
 	struct srcaddr		*srcaddr;
 	struct acct		acct;
-	unsigned char		wlog[WLOGSPACE];
+
+	/* Backend connection space */
+	struct http		bereq[1];
+	struct http		beresp[1];
+
 	unsigned char		*wlp, *wle;
 	unsigned		wlr;
+	unsigned char		wlog[WLOGSPACE];
 };
 
 struct workreq {

Modified: trunk/varnish-cache/bin/varnishd/cache_pipe.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_pipe.c	2007-07-03 08:11:17 UTC (rev 1621)
+++ trunk/varnish-cache/bin/varnishd/cache_pipe.c	2007-07-03 08:50:34 UTC (rev 1622)
@@ -78,6 +78,7 @@
 	char *b, *e;
 	struct worker *w;
 	struct pollfd fds[2];
+	char wsspc[8192];
 	int i;
 
 	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
@@ -87,19 +88,29 @@
 	vc = VBE_GetFd(sp);
 	if (vc == NULL)
 		return;
-	vc->bereq->logtag = HTTP_Tx;
+	w->bereq->logtag = HTTP_Tx;
 
-	http_CopyReq(w, vc->fd, vc->bereq, sp->http);
-	http_FilterHeader(w, vc->fd, vc->bereq, sp->http, HTTPH_R_PIPE);
-	http_PrintfHeader(w, vc->fd, vc->bereq, "X-Varnish: %u", sp->xid);
-	http_PrintfHeader(w, vc->fd, vc->bereq,
+	http_Setup(w->bereq, wsspc, sizeof wsspc);
+
+	http_CopyReq(w, vc->fd, w->bereq, sp->http);
+	http_FilterHeader(w, vc->fd, w->bereq, sp->http, HTTPH_R_PIPE);
+	http_PrintfHeader(w, vc->fd, w->bereq, "X-Varnish: %u", sp->xid);
+	http_PrintfHeader(w, vc->fd, w->bereq,
 	    "X-Forwarded-for: %s", sp->addr);
-	if (!http_GetHdr(vc->bereq, H_Host, &b)) {
-		http_PrintfHeader(w, vc->fd, vc->bereq, "Host: %s",
+
+	/* XXX: does this belong in VCL ? */
+	if (!http_GetHdr(w->bereq, H_Host, &b)) {
+		http_PrintfHeader(w, vc->fd, w->bereq, "Host: %s",
 		    sp->backend->hostname);
 	}
+
+	VCL_pipe_method(sp);
+
+	if (sp->handling == VCL_RET_ERROR)
+		INCOMPL();
+
 	WRK_Reset(w, &vc->fd);
-	http_Write(w, vc->bereq, 0);
+	http_Write(w, w->bereq, 0);
 
 	if (http_GetTail(sp->http, 0, &b, &e) && b != e)
 		WRK_Write(w, b, e - b);




More information about the varnish-commit mailing list