httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ruediger Pluem <rpl...@apache.org>
Subject Difference between Documentation and code for CacheMaxExpire
Date Tue, 17 Jan 2006 13:11:44 GMT

I found a difference between the documentation of CacheMaxExpire and the code.
The documentation of CacheMaxExpire says:

"This maximum value is enforced even if an expiry date was supplied with the document."

Looking at the code I found:

   /* if no expiry date then
     *   if lastmod
     *      expiry date = date + min((date - lastmod) * factor, maxexpire)
     *   else
     *      expire date = date + defaultexpire
     */
    if (exp == APR_DATE_BAD) {
        char expire_hdr[APR_RFC822_DATE_LEN];

        /* if lastmod == date then you get 0*conf->factor which results in
         *   an expiration time of now. This causes some problems with
         *   freshness calculations, so we choose the else path...
         */
        if ((lastmod != APR_DATE_BAD) && (lastmod < date)) {
            apr_time_t x = (apr_time_t) ((date - lastmod) * conf->factor);

            if (x > conf->maxex) {
                x = conf->maxex;
            }
            exp = date + x;
            apr_rfc822_date(expire_hdr, exp);
            apr_table_set(r->headers_out, "Expires", expire_hdr);
        }
        else {
            exp = date + conf->defex;
            apr_rfc822_date(expire_hdr, exp);
            apr_table_set(r->headers_out, "Expires", expire_hdr);
        }
    }
    info->expire = exp;

So CacheMaxExpire only applies if no valid expire date was delivered with the document.
Furthermore CacheDefaultExpire can be larger than CacheMaxExpire.

The question that remains: It this a bug in the code or in the documentation?


Regards

RĂ¼diger


Mime
View raw message