]> err.no Git - varnish/commitdiff
Convert pipe mode to use the bereq in struct worker.
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Tue, 3 Jul 2007 08:50:34 +0000 (08:50 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Tue, 3 Jul 2007 08:50:34 +0000 (08:50 +0000)
(See architect notes on wiki for reasoning)

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1622 d4fa192b-c00b-0410-8231-f00ffab90ce4

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

index abf11e5f339893b2c107a3d9266b3614746966b6..c6ca2051518f3697e817f0a9523bb8ada0c55071 100644 (file)
@@ -165,9 +165,14 @@ struct worker {
        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 {
index 23af9c004de24211205b6ea8dc54b6cc9118ea02..01c4d42e82a5a7911e1f693a8e39ce310f2b7a01 100644 (file)
@@ -78,6 +78,7 @@ PipeSession(struct sess *sp)
        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 @@ PipeSession(struct sess *sp)
        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);