]> granicus.if.org Git - apache/commitdiff
* LimitRequestBody does not affect Proxy requests (Should it?).
authorRuediger Pluem <rpluem@apache.org>
Tue, 21 Sep 2010 09:23:39 +0000 (09:23 +0000)
committerRuediger Pluem <rpluem@apache.org>
Tue, 21 Sep 2010 09:23:39 +0000 (09:23 +0000)
  Let it take effect if we decide to store the body in a
  temporary file on disk.

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

modules/proxy/mod_proxy_http.c

index 518bf96e59e3b5c0a625fe10cd6e1ceabd65f5e4..d1de99a3f7686cdd12b80df995cf7376cc4e4b62 100644 (file)
@@ -555,9 +555,12 @@ static int spool_reqbody_cl(apr_pool_t *p,
     apr_bucket *e;
     apr_off_t bytes, bytes_spooled = 0, fsize = 0;
     apr_file_t *tmpfile = NULL;
+    apr_off_t limit;
 
     body_brigade = apr_brigade_create(p, bucket_alloc);
 
+    limit = ap_get_limit_req_body(r);
+
     while (!APR_BUCKET_IS_EOS(APR_BRIGADE_FIRST(input_brigade)))
     {
         /* If this brigade contains EOS, either stop or remove it. */
@@ -572,6 +575,18 @@ static int spool_reqbody_cl(apr_pool_t *p,
         apr_brigade_length(input_brigade, 1, &bytes);
 
         if (bytes_spooled + bytes > MAX_MEM_SPOOL) {
+            /*
+             * LimitRequestBody does not affect Proxy requests (Should it?).
+             * Let it take effect if we decide to store the body in a
+             * temporary file on disk.
+             */
+            if (bytes_spooled + bytes > limit) {
+                ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
+                             "proxy: Request body is larger than the"
+                             " configured limit of %" APR_OFF_T_FMT ".",
+                             limit);
+                return HTTP_REQUEST_ENTITY_TOO_LARGE;
+            }
             /* can't spool any more in memory; write latest brigade to disk */
             if (tmpfile == NULL) {
                 const char *temp_dir;