[PATCH] Http range_filter: only initialize ctx->ranges in main request.
Maxim Dounin
mdounin at mdounin.ru
Fri Nov 11 19:13:59 UTC 2016
Hello!
On Thu, Nov 10, 2016 at 11:05:38AM +0800, 胡聪 (hucc) wrote:
> Hi,
>
> This is the second patch. But the function name does not show up, actually
> ngx_http_range_header_filter() shoud intead of
> @@ -224,12 +224,6 @@ parse:
That's fine, "show functions" in fact means "show last line
without leading spaces". This still makes reading diffs much
easier.
> # HG changeset patch
> # User hucongcong <hucong.c at foxmail.com>
> # Date 1478745892 -28800
> # Thu Nov 10 10:44:52 2016 +0800
> # Node ID 32838ae5fe67e7b3c628458e267a90ea1b4994a7
> # Parent c7b6269faec0d2ee6b4f4f625db8c219b5d0b010
> Http 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.
>
> diff -r c7b6269faec0 -r 32838ae5fe67 src/http/modules/ngx_http_range_filter_module.c
> --- a/src/http/modules/ngx_http_range_filter_module.c Thu Nov 10 10:17:53 2016 +0800
> +++ b/src/http/modules/ngx_http_range_filter_module.c Thu Nov 10 10:44:52 2016 +0800
> @@ -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
> }
> }
>
> + 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;
Committed, thanks.
--
Maxim Dounin
http://nginx.org/
More information about the nginx-devel
mailing list