Mailing List Archive

r1621 - trunk/varnish-cache/bin/varnishd
Author: phk
Date: 2007-07-03 10:11:17 +0200 (Tue, 03 Jul 2007)
New Revision: 1621

Modified:
trunk/varnish-cache/bin/varnishd/cache.h
trunk/varnish-cache/bin/varnishd/cache_backend.c
trunk/varnish-cache/bin/varnishd/cache_fetch.c
trunk/varnish-cache/bin/varnishd/cache_pipe.c
Log:
Rename the backend connections two http's "bereq" and "beresp"


Modified: trunk/varnish-cache/bin/varnishd/cache.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache.h 2007-07-03 08:07:09 UTC (rev 1620)
+++ trunk/varnish-cache/bin/varnishd/cache.h 2007-07-03 08:11:17 UTC (rev 1621)
@@ -185,8 +185,8 @@
TAILQ_ENTRY(vbe_conn) list;
struct backend *backend;
int fd;
- struct http *http;
- struct http *http2;
+ struct http *bereq;
+ struct http *beresp;
struct http http_mem[2];
};


Modified: trunk/varnish-cache/bin/varnishd/cache_backend.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_backend.c 2007-07-03 08:07:09 UTC (rev 1620)
+++ trunk/varnish-cache/bin/varnishd/cache_backend.c 2007-07-03 08:11:17 UTC (rev 1621)
@@ -89,13 +89,13 @@
return (NULL);
VSL_stats->n_vbe_conn++;
vbc->magic = VBE_CONN_MAGIC;
- vbc->http = &vbc->http_mem[0];
- vbc->http2 = &vbc->http_mem[1];
+ vbc->bereq = &vbc->http_mem[0];
+ vbc->beresp = &vbc->http_mem[1];
vbc->fd = -1;
p = (void *)(vbc + 1);
- http_Setup(vbc->http, p, space);
+ http_Setup(vbc->bereq, p, space);
p += space;
- http_Setup(vbc->http2, p, space);
+ http_Setup(vbc->beresp, p, space);
return (vbc);
}

@@ -337,8 +337,8 @@
AZ(close(vc->fd));
vc->fd = -1;
vc->backend = NULL;
- WS_Reset(vc->http->ws);
- WS_Reset(vc->http2->ws);
+ WS_Reset(vc->bereq->ws);
+ WS_Reset(vc->beresp->ws);
LOCK(&vbemtx);
TAILQ_INSERT_HEAD(&vbe_head, vc, list);
VSL_stats->backend_unused++;
@@ -355,8 +355,8 @@
assert(vc->fd >= 0);
AN(vc->backend);
WSL(w, SLT_BackendReuse, vc->fd, "%s", vc->backend->vcl_name);
- WS_Reset(vc->http->ws);
- WS_Reset(vc->http2->ws);
+ WS_Reset(vc->bereq->ws);
+ WS_Reset(vc->beresp->ws);
LOCK(&vbemtx);
VSL_stats->backend_recycle++;
TAILQ_INSERT_HEAD(&vc->backend->connlist, vc, list);

Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_fetch.c 2007-07-03 08:07:09 UTC (rev 1620)
+++ trunk/varnish-cache/bin/varnishd/cache_fetch.c 2007-07-03 08:11:17 UTC (rev 1621)
@@ -275,20 +275,20 @@
if (vc == NULL)
return (1);

- http_ClrHeader(vc->http);
- vc->http->logtag = HTTP_Tx;
- http_GetReq(w, vc->fd, vc->http, sp->http);
- http_FilterHeader(w, vc->fd, vc->http, sp->http, HTTPH_R_FETCH);
- http_PrintfHeader(w, vc->fd, vc->http, "X-Varnish: %u", sp->xid);
- http_PrintfHeader(w, vc->fd, vc->http,
+ http_ClrHeader(vc->bereq);
+ vc->bereq->logtag = HTTP_Tx;
+ http_GetReq(w, vc->fd, vc->bereq, sp->http);
+ http_FilterHeader(w, vc->fd, vc->bereq, sp->http, HTTPH_R_FETCH);
+ http_PrintfHeader(w, vc->fd, vc->bereq, "X-Varnish: %u", sp->xid);
+ http_PrintfHeader(w, vc->fd, vc->bereq,
"X-Forwarded-for: %s", sp->addr);
- if (!http_GetHdr(vc->http, H_Host, &b)) {
- http_PrintfHeader(w, vc->fd, vc->http, "Host: %s",
+ if (!http_GetHdr(vc->bereq, H_Host, &b)) {
+ http_PrintfHeader(w, vc->fd, vc->bereq, "Host: %s",
sp->backend->hostname);
}

WRK_Reset(w, &vc->fd);
- http_Write(w, vc->http, 0);
+ http_Write(w, vc->bereq, 0);
if (WRK_Flush(w)) {
/* XXX: cleanup */
return (1);
@@ -298,11 +298,11 @@
CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC);
CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC);

- if (http_RecvHead(vc->http, vc->fd)) {
+ if (http_RecvHead(vc->bereq, vc->fd)) {
/* XXX: cleanup */
return (1);
}
- if (http_DissectResponse(sp->wrk, vc->http, vc->fd)) {
+ if (http_DissectResponse(sp->wrk, vc->bereq, vc->fd)) {
/* XXX: cleanup */
return (1);
}
@@ -315,22 +315,22 @@

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);

- hp = vc->http2;
+ hp = vc->beresp;
http_ClrHeader(hp);
hp->logtag = HTTP_Obj;
- http_CopyResp(sp->wrk, sp->fd, hp, vc->http);
- http_FilterHeader(sp->wrk, sp->fd, hp, vc->http, HTTPH_A_INS);
+ http_CopyResp(sp->wrk, sp->fd, hp, vc->bereq);
+ http_FilterHeader(sp->wrk, sp->fd, hp, vc->bereq, HTTPH_A_INS);

if (body) {
- if (http_GetHdr(vc->http, H_Content_Length, &b))
- cls = fetch_straight(sp, vc->fd, vc->http, b);
- else if (http_HdrIs(vc->http, H_Transfer_Encoding, "chunked"))
- cls = fetch_chunked(sp, vc->fd, vc->http);
+ if (http_GetHdr(vc->bereq, H_Content_Length, &b))
+ cls = fetch_straight(sp, vc->fd, vc->bereq, b);
+ else if (http_HdrIs(vc->bereq, H_Transfer_Encoding, "chunked"))
+ cls = fetch_chunked(sp, vc->fd, vc->bereq);
else
- cls = fetch_eof(sp, vc->fd, vc->http);
+ cls = fetch_eof(sp, vc->fd, vc->bereq);
http_PrintfHeader(sp->wrk, sp->fd, hp,
"Content-Length: %u", sp->obj->len);
} else
@@ -359,7 +359,7 @@

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;

if (cls)

Modified: trunk/varnish-cache/bin/varnishd/cache_pipe.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_pipe.c 2007-07-03 08:07:09 UTC (rev 1620)
+++ trunk/varnish-cache/bin/varnishd/cache_pipe.c 2007-07-03 08:11:17 UTC (rev 1621)
@@ -87,19 +87,19 @@
vc = VBE_GetFd(sp);
if (vc == NULL)
return;
- vc->http->logtag = HTTP_Tx;
+ vc->bereq->logtag = HTTP_Tx;

- http_CopyReq(w, vc->fd, vc->http, sp->http);
- http_FilterHeader(w, vc->fd, vc->http, sp->http, HTTPH_R_PIPE);
- http_PrintfHeader(w, vc->fd, vc->http, "X-Varnish: %u", sp->xid);
- http_PrintfHeader(w, vc->fd, vc->http,
+ 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,
"X-Forwarded-for: %s", sp->addr);
- if (!http_GetHdr(vc->http, H_Host, &b)) {
- http_PrintfHeader(w, vc->fd, vc->http, "Host: %s",
+ if (!http_GetHdr(vc->bereq, H_Host, &b)) {
+ http_PrintfHeader(w, vc->fd, vc->bereq, "Host: %s",
sp->backend->hostname);
}
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)
WRK_Write(w, b, e - b);