summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorhucongcong <hucong.c@foxmail.com>2016-11-10 10:44:52 +0800
committerhucongcong <hucong.c@foxmail.com>2016-11-10 10:44:52 +0800
commit8f8a07f0801ea3a297bebe1ad9b25fcfcc278509 (patch)
tree8e2d1a6f70f60df39d514e7a78de85c66fa8fe08 /src
parent42298aeb13040cc94026a2d405726895fb19b1e0 (diff)
downloadnginx-8f8a07f0801ea3a297bebe1ad9b25fcfcc278509.tar.gz
nginx-8f8a07f0801ea3a297bebe1ad9b25fcfcc278509.tar.bz2
Range filter: only initialize ctx->ranges in main request.
It is not necessary to initialize ctx->ranges in all request, because ctx->ranges in subrequest will be reassigned to ctx->ranges of main request.
Diffstat (limited to 'src')
-rw-r--r--src/http/modules/ngx_http_range_filter_module.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/http/modules/ngx_http_range_filter_module.c b/src/http/modules/ngx_http_range_filter_module.c
index 095ef0621..951a00de1 100644
--- a/src/http/modules/ngx_http_range_filter_module.c
+++ b/src/http/modules/ngx_http_range_filter_module.c
@@ -224,12 +224,6 @@ parse:
ctx->offset = r->headers_out.content_offset;
- if (ngx_array_init(&ctx->ranges, r->pool, 1, sizeof(ngx_http_range_t))
- != NGX_OK)
- {
- return NGX_ERROR;
- }
-
ranges = r->single_range ? 1 : clcf->max_ranges;
switch (ngx_http_range_parse(r, ctx, ranges)) {
@@ -291,6 +285,12 @@ ngx_http_range_parse(ngx_http_request_t *r, ngx_http_range_filter_ctx_t *ctx,
}
}
+ if (ngx_array_init(&ctx->ranges, r->pool, 1, sizeof(ngx_http_range_t))
+ != NGX_OK)
+ {
+ return NGX_ERROR;
+ }
+
p = r->headers_in.range->value.data + 6;
size = 0;
content_length = r->headers_out.content_length_n;