]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Do not store aborted content.
authorGraham Leggett <minfrin@apache.org>
Wed, 13 Oct 2004 16:40:57 +0000 (16:40 +0000)
committerGraham Leggett <minfrin@apache.org>
Wed, 13 Oct 2004 16:40:57 +0000 (16:40 +0000)
PR: 21492
Obtained from:
Submitted by: R|diger Pl|m <r.pluem t-online.de>
Reviewed by: stoddard, jerenkrantz, minfrin, jim

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/APACHE_2_0_BRANCH@105430 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
STATUS
modules/experimental/mod_disk_cache.c

diff --git a/CHANGES b/CHANGES
index 6a17bb8e89ce9f322b130184668e429fea086ac9..8e5daa2462f443e2664df7420f2c4cd1d2537a96 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,8 @@
 Changes with Apache 2.0.53
 
+  *) mod_disk_cache: Do not store aborted content.  PR 21492.
+     [Rüiger Plü <r.pluem t-online.de>]
+
   *) mod_disk_cache: Correctly store cached content type.  PR 30278.
      [Rüiger Plü <r.pluem t-online.de>]
 
diff --git a/STATUS b/STATUS
index fdde6e56f5e784bd88369d0fc6e808b8eb895746..4a72fa79ee779d6e94755af998e182e1b4588852 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -1,5 +1,5 @@
 APACHE 2.0 STATUS:                                              -*-text-*-
-Last modified at [$Date: 2004/10/13 16:32:05 $]
+Last modified at [$Date: 2004/10/13 16:40:54 $]
 
 Release:
 
@@ -115,10 +115,6 @@ PATCHES TO BACKPORT FROM 2.1
        jorton replies: it does indeed, hang on...
        +1: jorton
 
-    *) Do not store aborted content. PR 21492.
-         modules/experimental/mod_disk_cache.c?r1=1.63&r2=1.64
-       +1: stoddard, jerenkrantz, minfrin, jim
-
     *) Try to correctly follow RFC 2616 13.3 on validating stale cache
        responses by teaching mod_cache's cache_select_url and
        cache_save_filter how to deal with this corner case.
index 7b753ee6d4669b4bdde7907206f0f62fda2ea092..1a8e3b7d8359ebec0e57742c749e9724445d5635 100644 (file)
@@ -704,6 +704,22 @@ static apr_status_t store_body(cache_handle_t *h, request_rec *r,
      */
     if (APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(bb))) {
         if (h->cache_obj->info.len <= 0) {
+          /* If the target value of the content length is unknown
+           * (h->cache_obj->info.len <= 0), check if connection has been
+           * aborted by client to avoid caching incomplete request bodies.
+           *
+           * This can happen with large responses from slow backends like
+           * Tomcat via mod_jk.
+           */
+          if (r->connection->aborted) {
+            ap_log_error(APLOG_MARK, APLOG_INFO, 0, r->server,
+                         "disk_cache: Discarding body for URL %s "
+                         "because connection has been aborted.",
+                         h->cache_obj->key);
+            /* Remove the intermediate cache file and return non-APR_SUCCESS */
+            file_cache_errorcleanup(dobj, r);
+            return APR_EGENERAL;
+          }
           /* XXX Fixme: file_size isn't constrained by size_t. */
           h->cache_obj->info.len = dobj->file_size;
         }