r157 - trunk/varnish-cache/bin/varnishd
phk at projects.linpro.no
phk at projects.linpro.no
Mon May 1 09:53:21 CEST 2006
Author: phk
Date: 2006-05-01 09:53:21 +0200 (Mon, 01 May 2006)
New Revision: 157
Modified:
trunk/varnish-cache/bin/varnishd/cache_fetch.c
Log:
Centralize "Connection: close" handling from the backend.
Loop until we have the entire chunk in chunked encoding
Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_fetch.c 2006-04-25 09:32:14 UTC (rev 156)
+++ trunk/varnish-cache/bin/varnishd/cache_fetch.c 2006-05-01 07:53:21 UTC (rev 157)
@@ -67,13 +67,8 @@
assert(i == st->len);
hash->deref(sp->obj);
+ return (0);
- if (http_GetHdr(sp->http, "Connection", &b) &&
- !strcasecmp(b, "close")) {
- return (1);
- } else {
- return (0);
- }
}
static int
@@ -130,11 +125,13 @@
p += e - b;
u -= e - b;
}
- if (u > 0) {
+ while (u > 0) {
i = read(fd, p, u);
+ assert(i > 0);
+ u -= i;
+ p += i;
if (0)
printf("u = %u i = %d\n", u, i);
- assert(i == u);
}
if (0)
printf("Store:\n%#H\n", st->ptr, st->len);
@@ -151,12 +148,7 @@
hash->deref(sp->obj);
- if (http_GetHdr(sp->http, "Connection", &b) &&
- !strcasecmp(b, "close")) {
- return (1);
- } else {
- return (0);
- }
+ return (0);
}
/*--------------------------------------------------------------------*/
@@ -208,6 +200,9 @@
cls = 0;
}
+ if (http_GetHdr(hp, "Connection", &b) && !strcasecmp(b, "close"))
+ cls = 1;
+
if (cls)
VBE_ClosedFd(fd_token);
else
More information about the varnish-commit
mailing list