Mercurial > hg > nginx
comparison src/http/modules/ngx_http_range_filter_module.c @ 6798:2decd6b34306
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.
author | hucongcong <hucong.c@foxmail.com> |
---|---|
date | Thu, 10 Nov 2016 10:44:52 +0800 |
parents | 6136a51f9c21 |
children | 0cdee26605f3 1adc6b0d5eaa |
comparison
equal
deleted
inserted
replaced
6797:40c2f3e06d23 | 6798:2decd6b34306 |
---|---|
222 return NGX_ERROR; | 222 return NGX_ERROR; |
223 } | 223 } |
224 | 224 |
225 ctx->offset = r->headers_out.content_offset; | 225 ctx->offset = r->headers_out.content_offset; |
226 | 226 |
227 if (ngx_array_init(&ctx->ranges, r->pool, 1, sizeof(ngx_http_range_t)) | |
228 != NGX_OK) | |
229 { | |
230 return NGX_ERROR; | |
231 } | |
232 | |
233 ranges = r->single_range ? 1 : clcf->max_ranges; | 227 ranges = r->single_range ? 1 : clcf->max_ranges; |
234 | 228 |
235 switch (ngx_http_range_parse(r, ctx, ranges)) { | 229 switch (ngx_http_range_parse(r, ctx, ranges)) { |
236 | 230 |
237 case NGX_OK: | 231 case NGX_OK: |
287 ngx_http_range_body_filter_module); | 281 ngx_http_range_body_filter_module); |
288 if (mctx) { | 282 if (mctx) { |
289 ctx->ranges = mctx->ranges; | 283 ctx->ranges = mctx->ranges; |
290 return NGX_OK; | 284 return NGX_OK; |
291 } | 285 } |
286 } | |
287 | |
288 if (ngx_array_init(&ctx->ranges, r->pool, 1, sizeof(ngx_http_range_t)) | |
289 != NGX_OK) | |
290 { | |
291 return NGX_ERROR; | |
292 } | 292 } |
293 | 293 |
294 p = r->headers_in.range->value.data + 6; | 294 p = r->headers_in.range->value.data + 6; |
295 size = 0; | 295 size = 0; |
296 content_length = r->headers_out.content_length_n; | 296 content_length = r->headers_out.content_length_n; |