]> err.no Git - varnish/commitdiff
Don't mess up the chunked encoding for nested esi:include
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Fri, 26 Oct 2007 11:13:32 +0000 (11:13 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Fri, 26 Oct 2007 11:13:32 +0000 (11:13 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2172 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/cache_response.c
varnish-cache/bin/varnishd/cache_vrt_esi.c

index 33eaea505199e638a732f40c47c9a051f249ec12..2633f76a2a4fe2f8a1e9de77d7f9116bd3da6e0e 100644 (file)
@@ -152,20 +152,21 @@ RES_WriteObj(struct sess *sp)
        unsigned u = 0;
        char lenbuf[20];
 
+       CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
        CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
 
        WRK_Reset(sp->wrk, &sp->fd);
-       if (sp->esis == 0) {
+       if (sp->esis == 0)
                sp->wrk->acct.hdrbytes += http_Write(sp->wrk, sp->http, 1);
-       } else {
-               sprintf(lenbuf, "%x\r\n", sp->obj->len);
-               sp->wrk->acct.hdrbytes += WRK_Write(sp->wrk, lenbuf, -1);
-       }
-       CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
 
        if (sp->wantbody && !VTAILQ_EMPTY(&sp->obj->esibits)) {
                ESI_Deliver(sp);
        } else if (sp->wantbody) {
+               if (sp->esis > 0) {
+                       sprintf(lenbuf, "%x\r\n", sp->obj->len);
+                       sp->wrk->acct.hdrbytes +=
+                           WRK_Write(sp->wrk, lenbuf, -1);
+               }
                
                VTAILQ_FOREACH(st, &sp->obj->store, list) {
                        CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
@@ -191,9 +192,9 @@ RES_WriteObj(struct sess *sp)
                        WRK_Write(sp->wrk, st->ptr, st->len);
                }
                assert(u == sp->obj->len);
+               if (sp->esis > 0) 
+                       WRK_Write(sp->wrk, "\r\n", -1);
        }
-       if (sp->esis > 0) 
-               WRK_Write(sp->wrk, "\r\n", -1);
        if (WRK_Flush(sp->wrk))
                vca_close_session(sp, "remote closed");
 }
index 806e1c5139033ea1d215c918f409214ec29fc528..363b0c9a34eb89ed6545f37d9eea6a769a94497a 100644 (file)
@@ -605,7 +605,8 @@ ESI_Deliver(struct sess *sp)
                sp->obj = obj;
 
        }
-       WRK_Write(sp->wrk, "0\r\n", -1);
+       if (sp->esis == 0)
+               WRK_Write(sp->wrk, "0\r\n", -1);
 }
 
 /*--------------------------------------------------------------------*/