Commit 45e049aa authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Make pipe use the new http manipulation.



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@534 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent dcef431e
......@@ -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);
......
......@@ -477,7 +477,7 @@ static int
cnt_pipe(struct sess *sp)
{
PipeSession(sp->wrk, sp);
PipeSession(sp);
sp->step = STP_DONE;
return (0);
}
......
......@@ -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;
}
......@@ -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;
......
......@@ -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++;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment