From: Jeff Trawick Date: Wed, 5 Jan 2005 17:29:52 +0000 (+0000) Subject: support extremely large request bodies by representing the X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a65178039f2a2c2923190dff1fbeec32e8a77b3d;p=thirdparty%2Fapache%2Fhttpd.git support extremely large request bodies by representing the 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 --- diff --git a/modules/proxy/proxy_http.c b/modules/proxy/proxy_http.c index c0038557cd9..ef53a84f195 100644 --- a/modules/proxy/proxy_http.c +++ b/modules/proxy/proxy_http.c @@ -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);