head	1.2;
access;
symbols;
locks; strict;
comment	@# @;


1.2
date	2011.11.03.14.48.08;	author anders;	state dead;
branches;
next	1.1;

1.1
date	2011.09.01.11.05.31;	author anders;	state Exp;
branches;
next	;


desc
@@


1.2
log
@Update to 3.0.2.
@
text
@--- bin/varnishd/cache.h.orig	2011-08-30 09:17:01.000000000 +0200
+++ bin/varnishd/cache.h	2011-09-01 12:16:24.000000000 +0200
@@@@ -898,6 +898,7 @@@@
 /* cache_vary.c */
 struct vsb *VRY_Create(const struct sess *sp, const struct http *hp);
 int VRY_Match(struct sess *sp, const uint8_t *vary);
+void VRY_Validate(const uint8_t *vary);
 
 /* cache_vcl.c */
 void VCL_Init(void);
--- bin/varnishd/cache_vary.c.orig	2011-08-30 09:17:01.000000000 +0200
+++ bin/varnishd/cache_vary.c	2011-09-01 12:16:24.000000000 +0200
@@@@ -247,3 +247,13 @@@@
 		sp->vary_l = vsp + 3;
 	return (retval);
 }
+
+void
+VRY_Validate(const uint8_t *vary)
+{
+
+	while (vary[2] != 0) {
+		assert(strlen((const char*)vary+3) == vary[2]);
+		vary += vry_len(vary);
+	}
+}
--- bin/varnishd/cache_hash.c.orig	2011-08-29 10:45:24.000000000 +0200
+++ bin/varnishd/cache_hash.c	2011-09-01 12:16:24.000000000 +0200
@@@@ -461,7 +461,12 @@@@
 	AN(oc->flags & OC_F_BUSY);
 	oc->refcnt = 1;
 
-	w->nbusyobj->vary = sp->vary_b;
+	/* XXX: clear w->nbusyobj before use */
+	VRY_Validate(sp->vary_b);
+	if (sp->vary_l != NULL)
+		w->nbusyobj->vary = sp->vary_b;
+	else
+		w->nbusyobj->vary = NULL;
 	oc->busyobj = w->nbusyobj;
 	w->nbusyobj = NULL;
 
--- bin/varnishd/cache_center.c.orig	2011-09-01 12:17:18.000000000 +0200
+++ bin/varnishd/cache_center.c	2011-09-01 12:16:24.000000000 +0200
@@@@ -802,6 +802,7 @@@@
 		    (void *)WS_Alloc(sp->obj->http->ws, varyl);
 		AN(sp->obj->vary);
 		memcpy(sp->obj->vary, VSB_data(vary), varyl);
+		VRY_Validate(sp->obj->vary);
 		VSB_delete(vary);
 	}
 
@@@@ -1080,10 +1081,12 @@@@
 		AZ(sp->vary_l);
 		AZ(sp->vary_e);
 		(void)WS_Reserve(sp->ws, 0);
-		sp->vary_b = (void*)sp->ws->f;
-		sp->vary_e = (void*)sp->ws->r;
-		sp->vary_b[2] = '\0';
+	} else {
+		AN(sp->ws->r);
 	}
+	sp->vary_b = (void*)sp->ws->f;
+	sp->vary_e = (void*)sp->ws->r;
+	sp->vary_b[2] = '\0';
 
 	oc = HSH_Lookup(sp, &oh);
 
@@@@ -1105,10 +1108,14 @@@@
 	if (oc->flags & OC_F_BUSY) {
 		sp->wrk->stats.cache_miss++;
 
-		if (sp->vary_l != NULL)
+		if (sp->vary_l != NULL) {
+			assert(oc->busyobj->vary == sp->vary_b);
+			VRY_Validate(oc->busyobj->vary);
 			WS_ReleaseP(sp->ws, (void*)sp->vary_l);
-		else
-			WS_Release(sp->ws, 0);
+		} else {
+			AZ(oc->busyobj->vary);
+			WS_Release(sp->ws, 0); 
+		}
 		sp->vary_b = NULL;
 		sp->vary_l = NULL;
 		sp->vary_e = NULL;
@


1.1
log
@Add bugfix for trac tickets 994&1001, crash in http_GetHdr(),
cache_http.c.
@
text
@@

