Return-Path: Delivered-To: apmail-httpd-cvs-archive@www.apache.org Received: (qmail 75382 invoked from network); 11 Aug 2005 17:31:14 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 11 Aug 2005 17:31:14 -0000 Received: (qmail 30909 invoked by uid 500); 11 Aug 2005 17:31:13 -0000 Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 30845 invoked by uid 500); 11 Aug 2005 17:31:12 -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 30832 invoked by uid 99); 11 Aug 2005 17:31:12 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 11 Aug 2005 10:31:12 -0700 Received: (qmail 75347 invoked by uid 65534); 11 Aug 2005 17:31:12 -0000 Message-ID: <20050811173112.75346.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: svn commit: r231486 - in /httpd/httpd/trunk: CHANGES modules/cache/mod_disk_cache.c Date: Thu, 11 Aug 2005 17:31:11 -0000 To: cvs@httpd.apache.org From: jerenkrantz@apache.org X-Mailer: svnmailer-1.0.3 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: jerenkrantz Date: Thu Aug 11 10:31:10 2005 New Revision: 231486 URL: http://svn.apache.org/viewcvs?rev=231486&view=rev Log: Implement mod_disk_cache's remove_url via a new filter. (Minor tweaks and comment fixes by Justin.) Suggested by: Paul Querna, Justin Erenkrantz Submitted by: Rudiger Plum Reviewed by: Justin Erenkrantz Modified: httpd/httpd/trunk/CHANGES httpd/httpd/trunk/modules/cache/mod_disk_cache.c Modified: httpd/httpd/trunk/CHANGES URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/CHANGES?rev=231486&r1=231485&r2=231486&view=diff ============================================================================== --- httpd/httpd/trunk/CHANGES [utf-8] (original) +++ httpd/httpd/trunk/CHANGES [utf-8] Thu Aug 11 10:31:10 2005 @@ -1,6 +1,9 @@ -*- coding: utf-8 -*- Changes with Apache 2.3.0 + *) mod_disk_cache: Properly remove files from cache when needed. + [Rüdiger Plüm ruediger.pluem vodafone.com] + *) mod_disk_cache: Support htcacheclean removing directories. [Andreas Steinmetz] Modified: httpd/httpd/trunk/modules/cache/mod_disk_cache.c URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/modules/cache/mod_disk_cache.c?rev=231486&r1=231485&r2=231486&view=diff ============================================================================== --- httpd/httpd/trunk/modules/cache/mod_disk_cache.c (original) +++ httpd/httpd/trunk/modules/cache/mod_disk_cache.c Thu Aug 11 10:31:10 2005 @@ -541,9 +541,51 @@ return OK; } -static int remove_url(const char *key) +static int remove_url(cache_handle_t *h, apr_pool_t *p) { - /* XXX: Delete file from cache! */ + apr_status_t rc; + disk_cache_object_t *dobj; + + /* Get disk cache object from cache handle */ + dobj = (disk_cache_object_t *) h->cache_obj->vobj; + if (!dobj) { + return DECLINED; + } + + /* Delete headers file */ + if (dobj->hdrsfile) { + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, NULL, + "disk_cache: Deleting %s from cache.", dobj->hdrsfile); + + rc = apr_file_remove(dobj->hdrsfile, p); + if ((rc != APR_SUCCESS) && (rc != APR_ENOENT)) { + /* Will only result in an output if httpd is started with -e debug. + * For reason see log_error_core for the case s == NULL. + */ + ap_log_error(APLOG_MARK, APLOG_DEBUG, rc, NULL, + "disk_cache: Failed to delete headers file %s from cache.", + dobj->hdrsfile); + return DECLINED; + } + } + + /* Delete data file */ + if (dobj->datafile) { + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, NULL, + "disk_cache: Deleting %s from cache.", dobj->datafile); + + rc = apr_file_remove(dobj->datafile, p); + if ((rc != APR_SUCCESS) && (rc != APR_ENOENT)) { + /* Will only result in an output if httpd is started with -e debug. + * For reason see log_error_core for the case s == NULL. + */ + ap_log_error(APLOG_MARK, APLOG_DEBUG, rc, NULL, + "disk_cache: Failed to delete data file %s from cache.", + dobj->datafile); + return DECLINED; + } + } + return OK; }