Welcome! Log In Create A New Profile

Advanced

Re: [PATCH] Http range_filter: only initialize ctx->ranges in main request.

Maxim Dounin
November 11, 2016 02:16PM
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@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/

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH] Http range_filter: only initialize ctx->ranges in main request.

胡聪 (hucc) 279 November 09, 2016 10:08PM

Re: [PATCH] Http range_filter: only initialize ctx->ranges in main request.

Maxim Dounin 160 November 11, 2016 02:16PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 163
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready