]> err.no Git - varnish/commitdiff
Centralize "Connection: close" handling from the backend.
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 1 May 2006 07:53:21 +0000 (07:53 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 1 May 2006 07:53:21 +0000 (07:53 +0000)
Loop until we have the entire chunk in chunked encoding

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@157 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/cache_fetch.c

index 2dc7ed05c934a49a53db8b60b20d8d6883abb5d4..33370305f7b6dc76a42787a612eb0a4e6cb03b51 100644 (file)
@@ -67,13 +67,8 @@ fetch_straight(struct worker *w, struct sess *sp, int fd, struct http *hp, char
        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 @@ printf("Tail: (B)\n%#H\n", b, e - b);
                        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 @@ printf("Store:\n%#H\n", st->ptr, st->len);
 
        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 @@ HERE();
                cls = 0;
        }
 
+       if (http_GetHdr(hp, "Connection", &b) && !strcasecmp(b, "close"))
+               cls = 1;
+
        if (cls)
                VBE_ClosedFd(fd_token);
        else