]> err.no Git - varnish/commitdiff
Move VCL_pipe_method() processing into cache_center.c where it belongs.
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Tue, 3 Jul 2007 20:49:42 +0000 (20:49 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Tue, 3 Jul 2007 20:49:42 +0000 (20:49 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1633 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/cache.h
varnish-cache/bin/varnishd/cache_center.c
varnish-cache/bin/varnishd/cache_pipe.c

index cbf5c2e40f3d5ade8a19cf0a19bf6a066b717145..d299e85f59b49205f9230ec953a4a2a2490088bd 100644 (file)
@@ -438,7 +438,7 @@ void http_CopyHome(struct http *hp);
 #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);
index 5f952c37e0d332c06d3af8a45d6128eee8b5da80..0f92fd8ab70e5e8ee2afb72971a2f6b83c2eabf7 100644 (file)
@@ -600,9 +600,34 @@ DOT err_pipe [label="ERROR",shape=plaintext]
 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);
 }
index 383a2533085395bd6f173c12c94e993ec75fd7c3..f32444512b03d0a6ede0fd5da54f6c6b06e2aab2 100644 (file)
@@ -72,14 +72,12 @@ rdf(struct pollfd *fds, int idx)
 }
 
 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 @@ PipeSession(struct sess *sp)
        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 @@ PipeSession(struct sess *sp)
 
        vbe_free_bereq(bereq);
        bereq = NULL;
-       hp = NULL;
 
        clock_gettime(CLOCK_REALTIME, &sp->t_resp);