[Varnish] #984: [PATCH] When a non-cacheable status is returned, default TTL is applied

Varnish varnish-bugs at varnish-cache.org
Fri Aug 19 17:59:23 CEST 2011


#984: [PATCH] When a non-cacheable status is returned, default TTL is applied
---------------------+------------------------------------------------------
 Reporter:  drwilco  |        Type:  defect  
   Status:  new      |    Priority:  normal  
Milestone:           |   Component:  varnishd
  Version:  trunk    |    Severity:  normal  
 Keywords:           |  
---------------------+------------------------------------------------------
 In cache_center.c:
 {{{
                 sp->wrk->exp.ttl = RFC2616_Ttl(sp);
 }}}

 In RFC2616_Ttl:
 {{{
         ttl = params->default_ttl;
 }}}
 ...
 {{{
         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 307: /* Temporary Redirect */
         case 410: /* Gone */
         case 404: /* Not Found */
 }}}
 ...
 {{{
         return (ttl);
 }}}

 So even though RFC2616_Ttl sets sp->wrk->exp.ttl to -1, the return(ttl) at
 the end overwrites that through the assignment in cache_center.c of the
 return value.

 So anything that's not a 200, 203, 300, 301, 302, 307, 410 or 404 will get
 the default TTL instead of -1.

-- 
Ticket URL: <http://varnish-cache.org/trac/ticket/984>
Varnish <http://varnish-cache.org/>
The Varnish HTTP Accelerator




More information about the varnish-bugs mailing list