Return-Path: Delivered-To: apmail-httpd-cvs-archive@www.apache.org Received: (qmail 15839 invoked from network); 5 Jul 2007 18:23:43 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 5 Jul 2007 18:23:43 -0000 Received: (qmail 73744 invoked by uid 500); 5 Jul 2007 18:23:45 -0000 Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 73691 invoked by uid 500); 5 Jul 2007 18:23:45 -0000 Mailing-List: contact cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@httpd.apache.org Received: (qmail 73680 invoked by uid 99); 5 Jul 2007 18:23:45 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Jul 2007 11:23:45 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Jul 2007 11:23:42 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 841A61A981D; Thu, 5 Jul 2007 11:23:21 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r553600 - in /httpd/httpd/branches/2.2.x: CHANGES STATUS modules/cache/mod_cache.c Date: Thu, 05 Jul 2007 18:23:21 -0000 To: cvs@httpd.apache.org From: jim@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070705182321.841A61A981D@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: jim Date: Thu Jul 5 11:23:20 2007 New Revision: 553600 URL: http://svn.apache.org/viewvc?view=rev&rev=553600 Log: Merge r539621 from trunk: mod_cache: Do not set Date or Expires when they are missing from the original response or are invalid. Submitted by: jerenkrantz Reviewed by: jim Modified: httpd/httpd/branches/2.2.x/CHANGES httpd/httpd/branches/2.2.x/STATUS httpd/httpd/branches/2.2.x/modules/cache/mod_cache.c Modified: httpd/httpd/branches/2.2.x/CHANGES URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/CHANGES?view=diff&rev=553600&r1=553599&r2=553600 ============================================================================== --- httpd/httpd/branches/2.2.x/CHANGES [utf-8] (original) +++ httpd/httpd/branches/2.2.x/CHANGES [utf-8] Thu Jul 5 11:23:20 2007 @@ -1,6 +1,9 @@ -*- coding: utf-8 -*- Changes with Apache 2.2.5 + *) mod_cache: Do not set Date or Expires when they are missing from + the original response or are invalid. [Justin Erenkrantz] + *) mod_cache: Correctly handle HEAD requests on expired cache content. PR 41230. [Niklas Edmundsson] Modified: httpd/httpd/branches/2.2.x/STATUS URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/STATUS?view=diff&rev=553600&r1=553599&r2=553600 ============================================================================== --- httpd/httpd/branches/2.2.x/STATUS (original) +++ httpd/httpd/branches/2.2.x/STATUS Thu Jul 5 11:23:20 2007 @@ -77,13 +77,6 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK: [ start all new proposals below, under PATCHES PROPOSED. ] - * mod_cache: Do not set Date or Expires when missing/invalid. - Trunk version of patch: - http://svn.apache.org/viewvc?view=rev&revision=539621 - 2.2.x version of patch: - (trunk applies cleanly) - +1: jerenkrantz, rpluem, jim - * mod_cgi: Reverse the regression documented in PR 39710 (ErrorDocuments are *badly* broken). Paul's patch reverses the change that introduced the bug. Modified: httpd/httpd/branches/2.2.x/modules/cache/mod_cache.c URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/modules/cache/mod_cache.c?view=diff&rev=553600&r1=553599&r2=553600 ============================================================================== --- httpd/httpd/branches/2.2.x/modules/cache/mod_cache.c (original) +++ httpd/httpd/branches/2.2.x/modules/cache/mod_cache.c Thu Jul 5 11:23:20 2007 @@ -318,7 +318,6 @@ static int cache_save_filter(ap_filter_t *f, apr_bucket_brigade *in) { int rv = !OK; - int date_in_errhdr = 0; request_rec *r = f->r; cache_request_rec *cache; cache_server_conf *conf; @@ -653,10 +652,7 @@ /* Read the date. Generate one if one is not supplied */ dates = apr_table_get(r->err_headers_out, "Date"); - if (dates != NULL) { - date_in_errhdr = 1; - } - else { + if (dates == NULL) { dates = apr_table_get(r->headers_out, "Date"); } if (dates != NULL) { @@ -668,25 +664,10 @@ now = apr_time_now(); if (info->date == APR_DATE_BAD) { /* No, or bad date */ - char *dates; /* no date header (or bad header)! */ - /* add one; N.B. use the time _now_ rather than when we were checking - * the cache - */ - if (date_in_errhdr == 1) { - apr_table_unset(r->err_headers_out, "Date"); - } - date = now; - dates = apr_pcalloc(r->pool, MAX_STRING_LEN); - apr_rfc822_date(dates, now); - apr_table_set(r->headers_out, "Date", dates); - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "cache: Added date header"); - info->date = date; - } - else { - date = info->date; + info->date = now; } + date = info->date; /* set response_time for HTTP/1.1 age calculations */ info->response_time = now; @@ -714,7 +695,6 @@ * expire date = date + defaultexpire */ if (exp == APR_DATE_BAD) { - char expire_hdr[APR_RFC822_DATE_LEN]; char *max_age_val; if (ap_cache_liststr(r->pool, cc_out, "max-age", &max_age_val) && @@ -745,13 +725,9 @@ 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;