|
|
8d2dcd |
diff --git a/docs/manual/mod/core.html.en b/docs/manual/mod/core.html.en
|
|
|
8d2dcd |
index e1ec8d0..833fa7b 100644
|
|
|
8d2dcd |
--- a/docs/manual/mod/core.html.en
|
|
|
8d2dcd |
+++ b/docs/manual/mod/core.html.en
|
|
|
8d2dcd |
@@ -2748,16 +2748,16 @@ subrequests
|
|
|
8d2dcd |
Description:Restricts the total size of the HTTP request body sent
|
|
|
8d2dcd |
from the client
|
|
|
8d2dcd |
Syntax:LimitRequestBody bytes
|
|
|
8d2dcd |
-Default:LimitRequestBody 0
|
|
|
8d2dcd |
+Default:LimitRequestBody 1073741824
|
|
|
8d2dcd |
Context:server config, virtual host, directory, .htaccess
|
|
|
8d2dcd |
Override:All
|
|
|
8d2dcd |
Status:Core
|
|
|
8d2dcd |
Module:core
|
|
|
8d2dcd |
+Compatibility:In Apache HTTP Server 2.4.53 and earlier, the default value
|
|
|
8d2dcd |
+ was 0 (unlimited)
|
|
|
8d2dcd |
|
|
|
8d2dcd |
- This directive specifies the number of bytes from 0
|
|
|
8d2dcd |
- (meaning unlimited) to 2147483647 (2GB) that are allowed in a
|
|
|
8d2dcd |
- request body. See the note below for the limited applicability
|
|
|
8d2dcd |
- to proxy requests.
|
|
|
8d2dcd |
+ This directive specifies the number of bytes
|
|
|
8d2dcd |
+ that are allowed in a request body. A value of 0 means unlimited.
|
|
|
8d2dcd |
|
|
|
8d2dcd |
The LimitRequestBody directive allows
|
|
|
8d2dcd |
the user to set a limit on the allowed size of an HTTP request
|
|
|
8d2dcd |
@@ -2783,12 +2783,6 @@ from the client
|
|
|
8d2dcd |
|
|
|
8d2dcd |
LimitRequestBody 102400
|
|
|
8d2dcd |
|
|
|
8d2dcd |
-
|
|
|
8d2dcd |
- For a full description of how this directive is interpreted by
|
|
|
8d2dcd |
- proxy requests, see the mod_proxy documentation.
|
|
|
8d2dcd |
-
|
|
|
8d2dcd |
-
|
|
|
8d2dcd |
-
|
|
|
8d2dcd |
|
|
|
8d2dcd |
|
|
|
8d2dcd |
|
|
|
8d2dcd |
diff --git a/docs/manual/mod/mod_proxy.html.en b/docs/manual/mod/mod_proxy.html.en
|
|
|
8d2dcd |
index 2cc6ace..c9e4634 100644
|
|
|
8d2dcd |
--- a/docs/manual/mod/mod_proxy.html.en
|
|
|
8d2dcd |
+++ b/docs/manual/mod/mod_proxy.html.en
|
|
|
8d2dcd |
@@ -459,9 +459,6 @@ ProxyPass "/examples" "http://backend.example.com/examples" timeout=10
|
|
|
8d2dcd |
Content-Length header, but the server is configured to filter incoming
|
|
|
8d2dcd |
request bodies.
|
|
|
8d2dcd |
|
|
|
8d2dcd |
- LimitRequestBody only applies to
|
|
|
8d2dcd |
- request bodies that the server will spool to disk
|
|
|
8d2dcd |
-
|
|
|
8d2dcd |
|
|
|
8d2dcd |
|
|
|
8d2dcd |
|
|
|
8d2dcd |
diff --git a/modules/http/http_filters.c b/modules/http/http_filters.c
|
|
|
8d2dcd |
index 6bedcac..393343a 100644
|
|
|
8d2dcd |
--- a/modules/http/http_filters.c
|
|
|
8d2dcd |
+++ b/modules/http/http_filters.c
|
|
|
8d2dcd |
@@ -1710,6 +1710,7 @@ AP_DECLARE(int) ap_setup_client_block(request_rec *r, int read_policy)
|
|
|
8d2dcd |
{
|
|
|
8d2dcd |
const char *tenc = apr_table_get(r->headers_in, "Transfer-Encoding");
|
|
|
8d2dcd |
const char *lenp = apr_table_get(r->headers_in, "Content-Length");
|
|
|
8d2dcd |
+ apr_off_t limit_req_body = ap_get_limit_req_body(r);
|
|
|
8d2dcd |
|
|
|
8d2dcd |
r->read_body = read_policy;
|
|
|
8d2dcd |
r->read_chunked = 0;
|
|
|
8d2dcd |
@@ -1748,6 +1749,11 @@ AP_DECLARE(int) ap_setup_client_block(request_rec *r, int read_policy)
|
|
|
8d2dcd |
return HTTP_REQUEST_ENTITY_TOO_LARGE;
|
|
|
8d2dcd |
}
|
|
|
8d2dcd |
|
|
|
8d2dcd |
+ if (limit_req_body > 0 && (r->remaining > limit_req_body)) {
|
|
|
8d2dcd |
+ /* will be logged when the body is discarded */
|
|
|
8d2dcd |
+ return HTTP_REQUEST_ENTITY_TOO_LARGE;
|
|
|
8d2dcd |
+ }
|
|
|
8d2dcd |
+
|
|
|
8d2dcd |
#ifdef AP_DEBUG
|
|
|
8d2dcd |
{
|
|
|
8d2dcd |
/* Make sure ap_getline() didn't leave any droppings. */
|
|
|
8d2dcd |
diff --git a/modules/proxy/mod_proxy_http.c b/modules/proxy/mod_proxy_http.c
|
|
|
8d2dcd |
index 7da9bde..1b7bb81 100644
|
|
|
8d2dcd |
--- a/modules/proxy/mod_proxy_http.c
|
|
|
8d2dcd |
+++ b/modules/proxy/mod_proxy_http.c
|
|
|
8d2dcd |
@@ -439,13 +439,10 @@ static int spool_reqbody_cl(proxy_http_req_t *req, apr_off_t *bytes_spooled)
|
|
|
8d2dcd |
apr_bucket *e;
|
|
|
8d2dcd |
apr_off_t bytes, fsize = 0;
|
|
|
8d2dcd |
apr_file_t *tmpfile = NULL;
|
|
|
8d2dcd |
- apr_off_t limit;
|
|
|
8d2dcd |
|
|
|
8d2dcd |
body_brigade = apr_brigade_create(p, bucket_alloc);
|
|
|
8d2dcd |
*bytes_spooled = 0;
|
|
|
8d2dcd |
|
|
|
8d2dcd |
- limit = ap_get_limit_req_body(r);
|
|
|
8d2dcd |
-
|
|
|
8d2dcd |
do {
|
|
|
8d2dcd |
if (APR_BRIGADE_EMPTY(input_brigade)) {
|
|
|
8d2dcd |
rv = stream_reqbody_read(req, input_brigade, 0);
|
|
|
8d2dcd |
@@ -462,17 +459,6 @@ static int spool_reqbody_cl(proxy_http_req_t *req, apr_off_t *bytes_spooled)
|
|
|
8d2dcd |
apr_brigade_length(input_brigade, 1, &bytes);
|
|
|
8d2dcd |
|
|
|
8d2dcd |
if (*bytes_spooled + bytes > MAX_MEM_SPOOL) {
|
|
|
8d2dcd |
- /*
|
|
|
8d2dcd |
- * LimitRequestBody does not affect Proxy requests (Should it?).
|
|
|
8d2dcd |
- * Let it take effect if we decide to store the body in a
|
|
|
8d2dcd |
- * temporary file on disk.
|
|
|
8d2dcd |
- */
|
|
|
8d2dcd |
- if (limit && (*bytes_spooled + bytes > limit)) {
|
|
|
8d2dcd |
- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01088)
|
|
|
8d2dcd |
- "Request body is larger than the configured "
|
|
|
8d2dcd |
- "limit of %" APR_OFF_T_FMT, limit);
|
|
|
8d2dcd |
- return HTTP_REQUEST_ENTITY_TOO_LARGE;
|
|
|
8d2dcd |
- }
|
|
|
8d2dcd |
/* can't spool any more in memory; write latest brigade to disk */
|
|
|
8d2dcd |
if (tmpfile == NULL) {
|
|
|
8d2dcd |
const char *temp_dir;
|
|
|
8d2dcd |
diff --git a/server/core.c b/server/core.c
|
|
|
8d2dcd |
index 09664fc..084e243 100644
|
|
|
8d2dcd |
--- a/server/core.c
|
|
|
8d2dcd |
+++ b/server/core.c
|
|
|
8d2dcd |
@@ -65,7 +65,7 @@
|
|
|
8d2dcd |
|
|
|
8d2dcd |
/* LimitRequestBody handling */
|
|
|
8d2dcd |
#define AP_LIMIT_REQ_BODY_UNSET ((apr_off_t) -1)
|
|
|
8d2dcd |
-#define AP_DEFAULT_LIMIT_REQ_BODY ((apr_off_t) 0)
|
|
|
8d2dcd |
+#define AP_DEFAULT_LIMIT_REQ_BODY ((apr_off_t) 1<<30) /* 1GB */
|
|
|
8d2dcd |
|
|
|
8d2dcd |
/* LimitXMLRequestBody handling */
|
|
|
8d2dcd |
#define AP_LIMIT_UNSET ((long) -1)
|