Commit 2291418c authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Rename the backend connections two http's "bereq" and "beresp"


git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@1621 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 23d37582
...@@ -185,8 +185,8 @@ struct vbe_conn { ...@@ -185,8 +185,8 @@ struct vbe_conn {
TAILQ_ENTRY(vbe_conn) list; TAILQ_ENTRY(vbe_conn) list;
struct backend *backend; struct backend *backend;
int fd; int fd;
struct http *http; struct http *bereq;
struct http *http2; struct http *beresp;
struct http http_mem[2]; struct http http_mem[2];
}; };
......
...@@ -89,13 +89,13 @@ vbe_new_conn(void) ...@@ -89,13 +89,13 @@ vbe_new_conn(void)
return (NULL); return (NULL);
VSL_stats->n_vbe_conn++; VSL_stats->n_vbe_conn++;
vbc->magic = VBE_CONN_MAGIC; vbc->magic = VBE_CONN_MAGIC;
vbc->http = &vbc->http_mem[0]; vbc->bereq = &vbc->http_mem[0];
vbc->http2 = &vbc->http_mem[1]; vbc->beresp = &vbc->http_mem[1];
vbc->fd = -1; vbc->fd = -1;
p = (void *)(vbc + 1); p = (void *)(vbc + 1);
http_Setup(vbc->http, p, space); http_Setup(vbc->bereq, p, space);
p += space; p += space;
http_Setup(vbc->http2, p, space); http_Setup(vbc->beresp, p, space);
return (vbc); return (vbc);
} }
...@@ -337,8 +337,8 @@ VBE_ClosedFd(struct worker *w, struct vbe_conn *vc, int already) ...@@ -337,8 +337,8 @@ VBE_ClosedFd(struct worker *w, struct vbe_conn *vc, int already)
AZ(close(vc->fd)); AZ(close(vc->fd));
vc->fd = -1; vc->fd = -1;
vc->backend = NULL; vc->backend = NULL;
WS_Reset(vc->http->ws); WS_Reset(vc->bereq->ws);
WS_Reset(vc->http2->ws); WS_Reset(vc->beresp->ws);
LOCK(&vbemtx); LOCK(&vbemtx);
TAILQ_INSERT_HEAD(&vbe_head, vc, list); TAILQ_INSERT_HEAD(&vbe_head, vc, list);
VSL_stats->backend_unused++; VSL_stats->backend_unused++;
...@@ -355,8 +355,8 @@ VBE_RecycleFd(struct worker *w, struct vbe_conn *vc) ...@@ -355,8 +355,8 @@ VBE_RecycleFd(struct worker *w, struct vbe_conn *vc)
assert(vc->fd >= 0); assert(vc->fd >= 0);
AN(vc->backend); AN(vc->backend);
WSL(w, SLT_BackendReuse, vc->fd, "%s", vc->backend->vcl_name); WSL(w, SLT_BackendReuse, vc->fd, "%s", vc->backend->vcl_name);
WS_Reset(vc->http->ws); WS_Reset(vc->bereq->ws);
WS_Reset(vc->http2->ws); WS_Reset(vc->beresp->ws);
LOCK(&vbemtx); LOCK(&vbemtx);
VSL_stats->backend_recycle++; VSL_stats->backend_recycle++;
TAILQ_INSERT_HEAD(&vc->backend->connlist, vc, list); TAILQ_INSERT_HEAD(&vc->backend->connlist, vc, list);
......
...@@ -275,20 +275,20 @@ Fetch(struct sess *sp) ...@@ -275,20 +275,20 @@ Fetch(struct sess *sp)
if (vc == NULL) if (vc == NULL)
return (1); return (1);
http_ClrHeader(vc->http); http_ClrHeader(vc->bereq);
vc->http->logtag = HTTP_Tx; vc->bereq->logtag = HTTP_Tx;
http_GetReq(w, vc->fd, vc->http, sp->http); http_GetReq(w, vc->fd, vc->bereq, sp->http);
http_FilterHeader(w, vc->fd, vc->http, sp->http, HTTPH_R_FETCH); http_FilterHeader(w, vc->fd, vc->bereq, sp->http, HTTPH_R_FETCH);
http_PrintfHeader(w, vc->fd, vc->http, "X-Varnish: %u", sp->xid); http_PrintfHeader(w, vc->fd, vc->bereq, "X-Varnish: %u", sp->xid);
http_PrintfHeader(w, vc->fd, vc->http, http_PrintfHeader(w, vc->fd, vc->bereq,
"X-Forwarded-for: %s", sp->addr); "X-Forwarded-for: %s", sp->addr);
if (!http_GetHdr(vc->http, H_Host, &b)) { if (!http_GetHdr(vc->bereq, H_Host, &b)) {
http_PrintfHeader(w, vc->fd, vc->http, "Host: %s", http_PrintfHeader(w, vc->fd, vc->bereq, "Host: %s",
sp->backend->hostname); sp->backend->hostname);
} }
WRK_Reset(w, &vc->fd); WRK_Reset(w, &vc->fd);
http_Write(w, vc->http, 0); http_Write(w, vc->bereq, 0);
if (WRK_Flush(w)) { if (WRK_Flush(w)) {
/* XXX: cleanup */ /* XXX: cleanup */
return (1); return (1);
...@@ -298,11 +298,11 @@ Fetch(struct sess *sp) ...@@ -298,11 +298,11 @@ Fetch(struct sess *sp)
CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC);
CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC); CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC);
if (http_RecvHead(vc->http, vc->fd)) { if (http_RecvHead(vc->bereq, vc->fd)) {
/* XXX: cleanup */ /* XXX: cleanup */
return (1); return (1);
} }
if (http_DissectResponse(sp->wrk, vc->http, vc->fd)) { if (http_DissectResponse(sp->wrk, vc->bereq, vc->fd)) {
/* XXX: cleanup */ /* XXX: cleanup */
return (1); return (1);
} }
...@@ -315,22 +315,22 @@ Fetch(struct sess *sp) ...@@ -315,22 +315,22 @@ Fetch(struct sess *sp)
assert(sp->obj->busy != 0); assert(sp->obj->busy != 0);
if (http_GetHdr(vc->http, H_Last_Modified, &b)) if (http_GetHdr(vc->bereq, H_Last_Modified, &b))
sp->obj->last_modified = TIM_parse(b); sp->obj->last_modified = TIM_parse(b);
hp = vc->http2; hp = vc->beresp;
http_ClrHeader(hp); http_ClrHeader(hp);
hp->logtag = HTTP_Obj; hp->logtag = HTTP_Obj;
http_CopyResp(sp->wrk, sp->fd, hp, vc->http); http_CopyResp(sp->wrk, sp->fd, hp, vc->bereq);
http_FilterHeader(sp->wrk, sp->fd, hp, vc->http, HTTPH_A_INS); http_FilterHeader(sp->wrk, sp->fd, hp, vc->bereq, HTTPH_A_INS);
if (body) { if (body) {
if (http_GetHdr(vc->http, H_Content_Length, &b)) if (http_GetHdr(vc->bereq, H_Content_Length, &b))
cls = fetch_straight(sp, vc->fd, vc->http, b); cls = fetch_straight(sp, vc->fd, vc->bereq, b);
else if (http_HdrIs(vc->http, H_Transfer_Encoding, "chunked")) else if (http_HdrIs(vc->bereq, H_Transfer_Encoding, "chunked"))
cls = fetch_chunked(sp, vc->fd, vc->http); cls = fetch_chunked(sp, vc->fd, vc->bereq);
else else
cls = fetch_eof(sp, vc->fd, vc->http); cls = fetch_eof(sp, vc->fd, vc->bereq);
http_PrintfHeader(sp->wrk, sp->fd, hp, http_PrintfHeader(sp->wrk, sp->fd, hp,
"Content-Length: %u", sp->obj->len); "Content-Length: %u", sp->obj->len);
} else } else
...@@ -359,7 +359,7 @@ Fetch(struct sess *sp) ...@@ -359,7 +359,7 @@ Fetch(struct sess *sp)
http_CopyHttp(&sp->obj->http, hp); http_CopyHttp(&sp->obj->http, hp);
if (http_GetHdr(vc->http, H_Connection, &b) && !strcasecmp(b, "close")) if (http_GetHdr(vc->bereq, H_Connection, &b) && !strcasecmp(b, "close"))
cls = 1; cls = 1;
if (cls) if (cls)
......
...@@ -87,19 +87,19 @@ PipeSession(struct sess *sp) ...@@ -87,19 +87,19 @@ PipeSession(struct sess *sp)
vc = VBE_GetFd(sp); vc = VBE_GetFd(sp);
if (vc == NULL) if (vc == NULL)
return; return;
vc->http->logtag = HTTP_Tx; vc->bereq->logtag = HTTP_Tx;
http_CopyReq(w, vc->fd, vc->http, sp->http); http_CopyReq(w, vc->fd, vc->bereq, sp->http);
http_FilterHeader(w, vc->fd, vc->http, sp->http, HTTPH_R_PIPE); http_FilterHeader(w, vc->fd, vc->bereq, sp->http, HTTPH_R_PIPE);
http_PrintfHeader(w, vc->fd, vc->http, "X-Varnish: %u", sp->xid); http_PrintfHeader(w, vc->fd, vc->bereq, "X-Varnish: %u", sp->xid);
http_PrintfHeader(w, vc->fd, vc->http, http_PrintfHeader(w, vc->fd, vc->bereq,
"X-Forwarded-for: %s", sp->addr); "X-Forwarded-for: %s", sp->addr);
if (!http_GetHdr(vc->http, H_Host, &b)) { if (!http_GetHdr(vc->bereq, H_Host, &b)) {
http_PrintfHeader(w, vc->fd, vc->http, "Host: %s", http_PrintfHeader(w, vc->fd, vc->bereq, "Host: %s",
sp->backend->hostname); sp->backend->hostname);
} }
WRK_Reset(w, &vc->fd); WRK_Reset(w, &vc->fd);
http_Write(w, vc->http, 0); http_Write(w, vc->bereq, 0);
if (http_GetTail(sp->http, 0, &b, &e) && b != e) if (http_GetTail(sp->http, 0, &b, &e) && b != e)
WRK_Write(w, b, e - b); 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