httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rpl...@apache.org
Subject svn commit: r389697 - /httpd/httpd/trunk/modules/cache/mod_disk_cache.c
Date Wed, 29 Mar 2006 06:53:53 GMT
Author: rpluem
Date: Tue Mar 28 22:53:51 2006
New Revision: 389697

URL: http://svn.apache.org/viewcvs?rev=389697&view=rev
Log:
* Check return value of apr_bucket_read when storing the response body to disk.
  Delete already cached data if an error occurs.

Submitted by: Brian Akins <brian.akins turner.com>
Reviewed by: Ruediger Pluem

Modified:
    httpd/httpd/trunk/modules/cache/mod_disk_cache.c

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=389697&r1=389696&r2=389697&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/cache/mod_disk_cache.c (original)
+++ httpd/httpd/trunk/modules/cache/mod_disk_cache.c Tue Mar 28 22:53:51 2006
@@ -984,7 +984,15 @@
     {
         const char *str;
         apr_size_t length, written;
-        apr_bucket_read(e, &str, &length, APR_BLOCK_READ);
+        rv = apr_bucket_read(e, &str, &length, APR_BLOCK_READ);
+        if (rv != APR_SUCCESS) {
+            ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
+                         "cache_disk: Error when reading bucket for URL %s",
+                         h->cache_obj->key);
+            /* Remove the intermediate cache file and return non-APR_SUCCESS */
+            file_cache_errorcleanup(dobj, r);
+            return APR_EGENERAL;
+        }
         rv = apr_file_write_full(dobj->tfd, str, length, &written);
         if (rv != APR_SUCCESS) {
             ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,



Mime
View raw message