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

Convert pipe mode to use the bereq in struct worker.

(See architect notes on wiki for reasoning)


git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@1622 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 2291418c
......@@ -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 {
......
......@@ -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);
......
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