Commit f15124d4 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Move VCL_pipe_method() processing into cache_center.c where it belongs.


git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@1633 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 5816bb93
......@@ -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);
......
......@@ -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);
}
......
......@@ -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);
......
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