You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2003/01/28 15:46:07 UTC

DO NOT REPLY [Bug 16493] New: - Incorrect handling of several Cache-Control directive by mod_proxy

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16493>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16493

Incorrect handling of several Cache-Control directive by mod_proxy

           Summary: Incorrect handling of several Cache-Control directive by
                    mod_proxy
           Product: Apache httpd-1.3
           Version: 1.3.27
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: mod_proxy
        AssignedTo: bugs@httpd.apache.org
        ReportedBy: tcastelle@generali.fr


Hello,

This bug is very related to the bug 16492 "mod_proxy doesn't correctly retrieve
values from Cache-Control Headers", please look at it also.

While trying to compare Apache 2.0's mod_cache and Apache 1.3's mod_proxy, I saw
a bug in the manner Apache handles Cache-Control directives. In the
proxy_cache.c file, near the line 1225, the following test :

/* handle expiration */
         ((-1 < smaxage && age < (smaxage - minfresh)) ||
          (-1 < maxage && age < (maxage + maxstale - minfresh)) ||
          (c->expire != BAD_DATE && age < (c->expire - c->date + maxstale -
minfresh)))
         ) {

is useless because it is always true, no matter if max-age is set or not. 
Let's take an example (I suppose here s-maxage, max-stale and min-fresh not set,
so smaxage = - 1, maxstale = 0 and minfresh = 0) :
- with age = 20, maxage = -1 (not set) and expire - date = 30, the second test
is FALSE. The third is TRUE. So the whole test is TRUE, the page is considered
to be fresh => no problem.
- with age = 20, maxage = 10 and expire - date = 30, the second test is FALSE,
but the third is still TRUE. So the whole test is TRUE, the page is considered
to be fresh => problem !!

I propose to change this like that :

      /* handle expiration */
         (-1 == smaxage || age < (smaxage - minfresh)) &&
         (-1 == maxage || age < (maxage + maxstale - minfresh)) &&
         (c->expire != BAD_DATE && age < (c->expire - c->date + maxstale -
minfresh))
         ) {

What do you think ?

Same kind problem exists with the test on line 1239...

I attach the patch I wrote to correct this.

Thanks for looking at it and tell me if it is correct or not !

Thomas.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org