]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
support extremely large request bodies by representing the
authorJeff Trawick <trawick@apache.org>
Wed, 5 Jan 2005 17:29:52 +0000 (17:29 +0000)
committerJeff Trawick <trawick@apache.org>
Wed, 5 Jan 2005 17:29:52 +0000 (17:29 +0000)
spool file with multiple file buckets, as with default handler

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

modules/proxy/proxy_http.c

index c0038557cd938122742ba7eb94737207b0e84ad7..ef53a84f195a063fc05630723d241c3b3193d10a 100644 (file)
@@ -584,7 +584,27 @@ static apr_status_t spool_reqbody_cl(apr_pool_t *p,
     terminate_headers(r->connection->bucket_alloc, header_brigade);
     APR_BRIGADE_CONCAT(header_brigade, body_brigade);
     if (tmpfile) {
-        e = apr_bucket_file_create(tmpfile, 0, fsize, p, origin->bucket_alloc);
+        /* For platforms where the size of the file may be larger than
+         * that which can be stored in a single bucket (where the
+         * length field is an apr_size_t), split it into several
+         * buckets: */
+        if (sizeof(apr_off_t) > sizeof(apr_size_t)
+            && fsize > AP_MAX_SENDFILE) {
+            e = apr_bucket_file_create(tmpfile, 0, AP_MAX_SENDFILE, p,
+                                       origin->bucket_alloc);
+            while (fsize > AP_MAX_SENDFILE) {
+                apr_bucket *ce;
+                apr_bucket_copy(e, &ce);
+                APR_BRIGADE_INSERT_TAIL(header_brigade, ce);
+                e->start += AP_MAX_SENDFILE;
+                fsize -= AP_MAX_SENDFILE;
+            }
+            e->length = (apr_size_t)fsize; /* Resize just the last bucket */
+        }
+        else {
+            e = apr_bucket_file_create(tmpfile, 0, (apr_size_t)fsize, p,
+                                       origin->bucket_alloc);
+        }
         APR_BRIGADE_INSERT_TAIL(header_brigade, e);
     }
     status = pass_brigade(r, conn, origin, header_brigade, 1);