r5737 - trunk/varnish-cache/bin/varnishd

phk at varnish-cache.org phk at varnish-cache.org
Thu Jan 13 19:44:07 CET 2011


Author: phk
Date: 2011-01-13 19:44:06 +0100 (Thu, 13 Jan 2011)
New Revision: 5737

Modified:
   trunk/varnish-cache/bin/varnishd/cache_esi_parse.c
Log:
Fix an off by one in esi delivery.

Correctly deliver last bits of object.

One test-case left, and that the trivia e00018.vtc



Modified: trunk/varnish-cache/bin/varnishd/cache_esi_parse.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_esi_parse.c	2011-01-13 17:15:36 UTC (rev 5736)
+++ trunk/varnish-cache/bin/varnishd/cache_esi_parse.c	2011-01-13 18:44:06 UTC (rev 5737)
@@ -551,7 +551,7 @@
 						break;
 					}
 				}
-				if (!vep->remove)
+				if (p < e && !vep->remove)
 					vep_mark_verbatim(vep, p + 1);
 			}
 		} else if (vep->state == VEP_NEXTTAG) {
@@ -583,7 +583,7 @@
 					vep->esicmt_p = vep->esicmt;
 				}
 			}
-			if (vep->esicmt_p == NULL && !vep->remove)
+			if (p < e && vep->esicmt_p == NULL && !vep->remove)
 				vep_mark_verbatim(vep, p);
 			if (p < e)
 				vep->state = VEP_STARTTAG;
@@ -974,13 +974,20 @@
 
 	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
 	vep = sp->wrk->vep;
+	sp->wrk->vep = NULL;
 	Debug("ENDING %p\n", vep);
 	CHECK_OBJ_NOTNULL(vep, VEP_MAGIC);
 
 	usleep(100);
-	Debug("ENDING STATE: %s\n", vep->state);
+	st = sp->wrk->storage;
+	if (st != NULL)
+		l = (const char *)(st->ptr + st->len) - (const char*)vep->ver_p;
+	else
+		l = 0;
+	Debug("ENDING STATE: %s (%ld)\n", vep->state, l);
 	if (vep->o_skip)
 		vep_emit_skip(vep);
+	vep->o_verbatim += l;
 	if (vep->o_verbatim)
 		vep_emit_verbatim(vep);
 	vsb_finish(vep->vsb);




More information about the varnish-commit mailing list