|
59 | 59 | #define AP_DEFAULT_MAX_RANGES 200 |
60 | 60 | #endif |
61 | 61 |
|
| 62 | +#define MAX_PREALLOC_RANGES 100 |
| 63 | + |
62 | 64 | APLOG_USE_MODULE(http); |
63 | 65 |
|
64 | 66 | typedef struct indexes_t { |
@@ -298,7 +300,6 @@ static int use_range_x(request_rec *r) |
298 | 300 | } |
299 | 301 |
|
300 | 302 | #define BYTERANGE_FMT "%" APR_OFF_T_FMT "-%" APR_OFF_T_FMT "/%" APR_OFF_T_FMT |
301 | | -#define MAX_PREALLOC_RANGES 100 |
302 | 303 |
|
303 | 304 | static apr_status_t copy_brigade_range(apr_bucket_brigade *bb, |
304 | 305 | apr_bucket_brigade *bbout, |
@@ -399,16 +400,6 @@ static apr_status_t copy_brigade_range(apr_bucket_brigade *bb, |
399 | 400 | return APR_SUCCESS; |
400 | 401 | } |
401 | 402 |
|
402 | | -static int get_max_ranges(request_rec *r) { |
403 | | - core_dir_config *core_conf = ap_get_core_module_config(r->per_dir_config); |
404 | | - if (core_conf->max_ranges >= 0 || core_conf->max_ranges == AP_MAXRANGES_UNLIMITED) { |
405 | | - return core_conf->max_ranges; |
406 | | - } |
407 | | - |
408 | | - /* Any other negative val means the default */ |
409 | | - return AP_DEFAULT_MAX_RANGES; |
410 | | -} |
411 | | - |
412 | 403 | static apr_status_t send_416(ap_filter_t *f, apr_bucket_brigade *tmpbb) |
413 | 404 | { |
414 | 405 | apr_bucket *e; |
@@ -443,8 +434,12 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_byterange_filter(ap_filter_t *f, |
443 | 434 | indexes_t *idx; |
444 | 435 | int i; |
445 | 436 | int original_status; |
446 | | - int max_ranges = get_max_ranges(r); |
| 437 | + int max_ranges; |
| 438 | + core_dir_config *core_conf = ap_get_core_module_config(r->per_dir_config); |
447 | 439 |
|
| 440 | + max_ranges = ( (core_conf->max_ranges >= 0 || core_conf->max_ranges == AP_MAXRANGES_UNLIMITED) |
| 441 | + ? core_conf->max_ranges |
| 442 | + : AP_DEFAULT_MAX_RANGES ); |
448 | 443 | /* |
449 | 444 | * Iterate through the brigade until reaching EOS or a bucket with |
450 | 445 | * unknown length. |
|
0 commit comments