[Varnish] #236: Past-date Expires is not handled correctly

Varnish varnish-bugs at projects.linpro.no
Thu May 1 22:49:29 CEST 2008

#236: Past-date Expires is not handled correctly
 Reporter:  newbery  |       Owner:  des  
     Type:  defect   |      Status:  new  
 Priority:  normal   |   Milestone:       
Component:  build    |     Version:  trunk
 Severity:  normal   |    Keywords:       
 Using the 1.1.2 release, lines 84-86 in rcd2616.c show this pseudocode:

                 if (date && expires)
                         retirement_age =
                             max(0, min(retirement_age, Expires: - Date:)

 But in lines 146-145, we have,

                 if (h_date != 0 && h_expires != 0) {
                         if (h_date < h_expires &&
                             h_expires - h_date < retirement_age)
                                 retirement_age = h_expires - h_date;

 Which appears to impose an extra requirement that Expires must be greater
 than Date.  This breaks the usecase where Expires is deliberately set to a
 past date as a shorthand for "do not cache".  At the moment, the only
 solution is to set a default ttl of zero seconds upon Varnish startup.

 It would seem to be better if we could fix this in the code to abide by
 the apparent intent of the pseudocode.

 This issue was discussed on the list:

Ticket URL: <http://varnish.projects.linpro.no/ticket/236>
Varnish <http://varnish.projects.linpro.no/>
The Varnish HTTP Accelerator

More information about the varnish-bugs mailing list