r1633 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Tue Jul 3 22:49:43 CEST 2007


Author: phk
Date: 2007-07-03 22:49:42 +0200 (Tue, 03 Jul 2007)
New Revision: 1633

Modified:
   trunk/varnish-cache/bin/varnishd/cache.h
   trunk/varnish-cache/bin/varnishd/cache_center.c
   trunk/varnish-cache/bin/varnishd/cache_pipe.c
Log:
Move VCL_pipe_method() processing into cache_center.c where it belongs.


Modified: trunk/varnish-cache/bin/varnishd/cache.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache.h	2007-07-03 20:38:38 UTC (rev 1632)
+++ trunk/varnish-cache/bin/varnishd/cache.h	2007-07-03 20:49:42 UTC (rev 1633)
@@ -438,7 +438,7 @@
 #undef HTTPH
 
 /* cache_pipe.c */
-void PipeSession(struct sess *sp);
+void PipeSession(struct sess *sp, struct bereq *bereq);
 
 /* cache_pool.c */
 void WRK_Init(void);

Modified: trunk/varnish-cache/bin/varnishd/cache_center.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_center.c	2007-07-03 20:38:38 UTC (rev 1632)
+++ trunk/varnish-cache/bin/varnishd/cache_center.c	2007-07-03 20:49:42 UTC (rev 1633)
@@ -600,9 +600,34 @@
 static int
 cnt_pipe(struct sess *sp)
 {
+	struct bereq *bereq;
+	struct http *hp;
+	char *b;
 
 	sp->wrk->acct.pipe++;
-	PipeSession(sp);
+
+	bereq = vbe_new_bereq();
+	XXXAN(bereq);
+	hp = bereq->http;
+	hp->logtag = HTTP_Tx;
+
+	http_CopyReq(sp->wrk, sp->fd, hp, sp->http);
+	http_FilterHeader(sp->wrk, sp->fd, hp, sp->http, HTTPH_R_PIPE);
+	http_PrintfHeader(sp->wrk, sp->fd, hp, "X-Varnish: %u", sp->xid);
+	http_PrintfHeader(sp->wrk, sp->fd, hp, "X-Forwarded-for: %s", sp->addr);
+
+	/* XXX: does this belong in VCL ? */
+	if (!http_GetHdr(hp, H_Host, &b)) {
+		http_PrintfHeader(sp->wrk, sp->fd, hp, "Host: %s",
+		    sp->backend->hostname);
+	}
+
+	VCL_pipe_method(sp);
+
+	if (sp->handling == VCL_RET_ERROR)
+		INCOMPL();
+
+	PipeSession(sp, bereq);
 	sp->step = STP_DONE;
 	return (0);
 }

Modified: trunk/varnish-cache/bin/varnishd/cache_pipe.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_pipe.c	2007-07-03 20:38:38 UTC (rev 1632)
+++ trunk/varnish-cache/bin/varnishd/cache_pipe.c	2007-07-03 20:49:42 UTC (rev 1633)
@@ -72,14 +72,12 @@
 }
 
 void
-PipeSession(struct sess *sp)
+PipeSession(struct sess *sp, struct bereq *bereq)
 {
 	struct vbe_conn *vc;
 	char *b, *e;
 	struct worker *w;
 	struct pollfd fds[2];
-	struct bereq *bereq;
-	struct http *hp;
 	int i;
 
 	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
@@ -90,30 +88,8 @@
 	if (vc == NULL)
 		return;
 
-	bereq = vbe_new_bereq();
-	AN(bereq);
-	hp = bereq->http;
-	hp->logtag = HTTP_Tx;
-
-	http_CopyReq(w, vc->fd, hp, sp->http);
-	http_FilterHeader(w, vc->fd, hp, sp->http, HTTPH_R_PIPE);
-	http_PrintfHeader(w, vc->fd, hp, "X-Varnish: %u", sp->xid);
-	http_PrintfHeader(w, vc->fd, hp,
-	    "X-Forwarded-for: %s", sp->addr);
-
-	/* XXX: does this belong in VCL ? */
-	if (!http_GetHdr(hp, H_Host, &b)) {
-		http_PrintfHeader(w, vc->fd, hp, "Host: %s",
-		    sp->backend->hostname);
-	}
-
-	VCL_pipe_method(sp);
-
-	if (sp->handling == VCL_RET_ERROR)
-		INCOMPL();
-
 	WRK_Reset(w, &vc->fd);
-	http_Write(w, hp, 0);
+	http_Write(w, bereq->http, 0);
 
 	if (http_GetTail(sp->http, 0, &b, &e) && b != e)
 		WRK_Write(w, b, e - b);
@@ -126,7 +102,6 @@
 
 	vbe_free_bereq(bereq);
 	bereq = NULL;
-	hp = NULL;
 
 	clock_gettime(CLOCK_REALTIME, &sp->t_resp);
 




More information about the varnish-commit mailing list