You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by tr...@apache.org on 2005/01/05 18:29:53 UTC

svn commit: r124230 - /httpd/httpd/branches/proxy-reqbody/modules/proxy/proxy_http.c

Author: trawick
Date: Wed Jan  5 09:29:52 2005
New Revision: 124230

URL: http://svn.apache.org/viewcvs?view=rev&rev=124230
Log:
support extremely large request bodies by representing the
spool file with multiple file buckets, as with default handler

Modified:
   httpd/httpd/branches/proxy-reqbody/modules/proxy/proxy_http.c

Modified: httpd/httpd/branches/proxy-reqbody/modules/proxy/proxy_http.c
Url: http://svn.apache.org/viewcvs/httpd/httpd/branches/proxy-reqbody/modules/proxy/proxy_http.c?view=diff&rev=124230&p1=httpd/httpd/branches/proxy-reqbody/modules/proxy/proxy_http.c&r1=124229&p2=httpd/httpd/branches/proxy-reqbody/modules/proxy/proxy_http.c&r2=124230
==============================================================================
--- httpd/httpd/branches/proxy-reqbody/modules/proxy/proxy_http.c	(original)
+++ httpd/httpd/branches/proxy-reqbody/modules/proxy/proxy_http.c	Wed Jan  5 09:29:52 2005
@@ -584,7 +584,27 @@
     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);