[3.0] af52295 Add a couple of asserts to make sure we only do ims/range on 200.

Tollef Fog Heen tfheen at varnish-cache.org
Wed Aug 17 11:27:41 CEST 2011


commit af52295ecea890c2a9d456d65e390d1e23255828
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Aug 10 12:04:58 2011 +0000

    Add a couple of asserts to make sure we only do ims/range on 200.

diff --git a/bin/varnishd/cache_response.c b/bin/varnishd/cache_response.c
index 11f7fb6..0c306df 100644
--- a/bin/varnishd/cache_response.c
+++ b/bin/varnishd/cache_response.c
@@ -47,6 +47,7 @@ res_do_304(struct sess *sp)
 	char lm[64];
 	char *p;
 
+	assert(sp->obj->response == 200);
 	http_ClrHeader(sp->wrk->resp);
 	sp->wrk->resp->logtag = HTTP_Tx;
 	http_SetResp(sp->wrk->resp, "HTTP/1.1", 304, "Not Modified");
@@ -127,7 +128,7 @@ res_dorange(struct sess *sp, const char *r, ssize_t *plow, ssize_t *phigh)
 {
 	ssize_t low, high, has_low;
 
-	(void)sp;
+	assert(sp->obj->response == 200);
 	if (strncmp(r, "bytes=", 6))
 		return;
 	r += 6;



More information about the varnish-commit mailing list