]> err.no Git - varnish/commitdiff
Make pipe use the new http manipulation.
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Fri, 21 Jul 2006 10:44:12 +0000 (10:44 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Fri, 21 Jul 2006 10:44:12 +0000 (10:44 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@534 d4fa192b-c00b-0410-8231-f00ffab90ce4

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

index f743a654a5df203edc29d14f0bca80456c62dfbc..b017383e6090fd24ab774f25eb8b54e77149f2f9 100644 (file)
@@ -333,7 +333,7 @@ void PassSession(struct sess *sp);
 void PassBody(struct worker *w, struct sess *sp);
 
 /* cache_pipe.c */
-void PipeSession(struct worker *w, struct sess *sp);
+void PipeSession(struct sess *sp);
 
 /* cache_pool.c */
 void WRK_Init(void);
index 9ef843884ea7cb20f95f90c829d6f916a0c78175..e6adababe8410453f15e2f2204e0bc891172f6fa 100644 (file)
@@ -477,7 +477,7 @@ static int
 cnt_pipe(struct sess *sp)
 {
 
-       PipeSession(sp->wrk, sp);
+       PipeSession(sp);
        sp->step = STP_DONE;
        return (0);
 }
index fbb4635093c499aa5e9cebcbbcded06e654228ed..a807f33e861a41aaeea7070246dfd6eb4554bcce 100644 (file)
@@ -191,6 +191,7 @@ PassSession(struct sess *sp)
        CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
        CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC);
        w = sp->wrk;
+
        vc = VBE_GetFd(sp->backend, sp->xid);
        assert(vc != NULL);
        VSL(SLT_Backend, sp->fd, "%d %s", vc->fd, sp->backend->vcl_name);
@@ -214,6 +215,5 @@ PassSession(struct sess *sp)
        (void)event_base_loop(w->eb, 0);
        http_DissectResponse(hp, vc->fd);
 
-       sp->bkd_http = hp;
        sp->vbc = vc;
 }
index 66bfc1a02e70459a290f14e8b75966c999263666..ba893e94736529fbd0f91556dba689042bc831a8 100644 (file)
@@ -45,27 +45,34 @@ rdf(int fd, short event, void *arg)
 }
 
 void
-PipeSession(struct worker *w, struct sess *sp)
+PipeSession(struct sess *sp)
 {
-       int i;
        struct vbe_conn *vc;
        struct edir e1, e2;
        char *b, *e;
+       struct worker *w;
+
+       CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
+       CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC);
+       w = sp->wrk;
 
        vc = VBE_GetFd(sp->backend, sp->xid);
        assert(vc != NULL);
        VSL(SLT_Backend, sp->fd, "%d %s", vc->fd, sp->backend->vcl_name);
 
-       http_BuildSbuf(vc->fd, Build_Pipe, w->sb, sp->http);
-       i = write(vc->fd, sbuf_data(w->sb), sbuf_len(w->sb));
-       assert(i == sbuf_len(w->sb));
-       if (http_GetTail(sp->http, 0, &b, &e) && b != e) {
-               i = write(vc->fd, b, e - b);
-               if (i != e - b) {
-                       close (vc->fd);
-                       vca_close_session(sp, "pipe");
-                       VBE_ClosedFd(vc);
-               }
+       http_CopyReq(vc->fd, vc->http, sp->http);
+       http_FilterHeader(vc->fd, vc->http, sp->http, HTTPH_R_PIPE);
+       http_PrintfHeader(vc->fd, vc->http, "X-Varnish: %u", sp->xid);
+       WRK_Reset(w, &vc->fd);
+       http_Write(w, vc->http, 0);
+
+       if (http_GetTail(sp->http, 0, &b, &e) && b != e)
+               WRK_Write(w, b, e - b);
+
+       if (WRK_Flush(w)) {
+               vca_close_session(sp, "pipe");
+               VBE_ClosedFd(vc);
+               return;
        }
 
        e1.fd = vc->fd;
index 31b730e0c19389de8742229b109cfe7a7b72d4d8..f3850fbcfe3bb32dc1d8edbaadd869ce42509fae 100644 (file)
@@ -50,7 +50,6 @@ WRK_Flush(struct worker *w)
        CHECK_OBJ_NOTNULL(w, WORKER_MAGIC);
        if (*w->wfd < 0 || w->niov == 0 || w->werr)
                return (w->werr);
-VSL(SLT_Debug, 0, "%s %d", __func__, *w->wfd);
        i = writev(*w->wfd, w->iov, w->niov);
        if (i != w->liov)
                w->werr++;