@@ -178,6 +178,8 @@ static void *create_core_dir_config(apr_pool_t *a, char *dir)
178178 conf -> enable_sendfile = ENABLE_SENDFILE_UNSET ;
179179 conf -> allow_encoded_slashes = 0 ;
180180 conf -> decode_encoded_slashes = 0 ;
181+
182+ conf -> max_ranges = -1 ;
181183
182184 return (void * )conf ;
183185}
@@ -397,6 +399,8 @@ static void *merge_core_dir_configs(apr_pool_t *a, void *basev, void *newv)
397399 }
398400 }
399401
402+ conf -> max_ranges = new -> max_ranges != -1 ? new -> max_ranges : base -> max_ranges ;
403+
400404 return (void * )conf ;
401405}
402406
@@ -3260,6 +3264,16 @@ static const char *set_limit_xml_req_body(cmd_parms *cmd, void *conf_,
32603264 return NULL ;
32613265}
32623266
3267+ static const char * set_max_ranges (cmd_parms * cmd , void * conf_ , const char * arg )
3268+ {
3269+ core_dir_config * conf = conf_ ;
3270+
3271+ conf -> max_ranges = atoi (arg );
3272+ if (conf -> max_ranges < 0 )
3273+ return "MaxRanges requires a non-negative integer (0 = unlimited)" ;
3274+
3275+ return NULL ;
3276+ }
32633277AP_DECLARE (size_t ) ap_get_limit_xml_body (const request_rec * r )
32643278{
32653279 core_dir_config * conf ;
@@ -3876,6 +3890,9 @@ AP_INIT_TAKE1("LimitXMLRequestBody", set_limit_xml_req_body, NULL, OR_ALL,
38763890AP_INIT_RAW_ARGS ("Mutex" , ap_set_mutex , NULL , RSRC_CONF ,
38773891 "mutex (or \"default\") and mechanism" ),
38783892
3893+ AP_INIT_TAKE1 ("MaxRanges" , set_max_ranges , NULL , RSRC_CONF |ACCESS_CONF ,
3894+ "Maximum number of Ranges in a request before returning the entire "
3895+ "resource, or 0 for unlimited" ),
38793896/* System Resource Controls */
38803897#ifdef RLIMIT_CPU
38813898AP_INIT_TAKE12 ("RLimitCPU" , set_limit_cpu ,
0 commit comments