[master] 25c5f2e Move more policy stuff to rfc2616.c
Poul-Henning Kamp
phk at varnish-cache.org
Mon Mar 7 12:09:14 CET 2011
commit 25c5f2ed3229e41e99eadff57374c3a93b41a356
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Mar 7 11:09:03 2011 +0000
Move more policy stuff to rfc2616.c
diff --git a/bin/varnishd/cache_center.c b/bin/varnishd/cache_center.c
index 981e4f2..9146392 100644
--- a/bin/varnishd/cache_center.c
+++ b/bin/varnishd/cache_center.c
@@ -530,24 +530,6 @@ cnt_fetch(struct sess *sp)
EXP_Clr(&sp->wrk->exp);
sp->wrk->exp.ttl = RFC2616_Ttl(sp);
- /*
- * Initial cacheability determination per [RFC2616, 13.4]
- * We do not support ranges yet, so 206 is out.
- */
- switch (sp->err_code) {
- case 200: /* OK */
- case 203: /* Non-Authoritative Information */
- case 300: /* Multiple Choices */
- case 301: /* Moved Permanently */
- case 302: /* Moved Temporarily */
- case 410: /* Gone */
- case 404: /* Not Found */
- break;
- default:
- sp->wrk->exp.ttl = -1.;
- break;
- }
-
/* pass from vclrecv{} has negative TTL */
if (sp->objcore == NULL)
sp->wrk->exp.ttl = -1.;
diff --git a/bin/varnishd/rfc2616.c b/bin/varnishd/rfc2616.c
index 0295be5..2c6c851 100644
--- a/bin/varnishd/rfc2616.c
+++ b/bin/varnishd/rfc2616.c
@@ -87,8 +87,22 @@ RFC2616_Ttl(const struct sess *sp)
h_expires = 0;
h_date = 0;
- do { /* Allows us to break when we want out */
+ /*
+ * Initial cacheability determination per [RFC2616, 13.4]
+ * We do not support ranges yet, so 206 is out.
+ */
+ switch (sp->err_code) {
+ default:
+ sp->wrk->exp.ttl = -1.;
+ break;
+ case 200: /* OK */
+ case 203: /* Non-Authoritative Information */
+ case 300: /* Multiple Choices */
+ case 301: /* Moved Permanently */
+ case 302: /* Moved Temporarily */
+ case 410: /* Gone */
+ case 404: /* Not Found */
/*
* First find any relative specification from the backend
* These take precedence according to RFC2616, 13.2.4
@@ -150,7 +164,7 @@ RFC2616_Ttl(const struct sess *sp)
ttl = (int)(h_expires - h_date);
}
- } while (0);
+ }
/* calculated TTL, Our time, Date, Expires, max-age, age */
WSP(sp, SLT_TTL, "%u RFC %g %g %g %g %u %u", sp->xid,
More information about the varnish-commit
mailing list