Welcome! Log In Create A New Profile

Advanced

Re: [PATCH] Fastcgi: core dump was caused by duplicated request header

Maxim Dounin
June 11, 2011 08:32AM
Hello!

On Fri, Jun 10, 2011 at 04:55:55PM +0800, Simon Liu wrote:

> Thanks!
>
> I refactor the prev patch.
>
> this is new patch:

[...]

> @@ -707,7 +769,10 @@
> ignored = NULL;
>
> flcf = ngx_http_get_module_loc_conf(r, ngx_http_fastcgi_module);
> + cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
>
> + allow_underscores = cscf->underscores_in_headers;
> +

This is a layering violation. This is also a good example of why
layering violation is bad: this is incorrect as underscores may as
well appear in headers with "ignore_invalid_headers off;", even if
undescores_in_headers is off.

> if (flcf->params_len) {
> ngx_memzero(&le, sizeof(ngx_http_script_engine_t));
>
> @@ -784,6 +849,14 @@
> }
>
> if (ngx_hash_find(&flcf->headers_hash, hash, lowcase_key,
> n)) {
> +
> + if (header_params == flcf->header_params
> + || ngx_http_fastcgi_ignored_header(ignored,
> &header[i],
> + header_params, allow_underscores) == NGX_OK)
> + {
> + continue;
> + }
> +
> ignored[header_params++] = &header[i];

I would suggest using bitmask sized after number of headers in
request instead.

Alternatively, nginx dynamically sized array or list may be used
for ignored, this should be a bit closer to original code. Though
I personally think bitmask would be better.

Maxim Dounin

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

[PATCH] Fastcgi: core dump was caused by duplicated request header

Simon Liu 2164 May 31, 2011 12:26PM

Re: [PATCH] Fastcgi: core dump was caused by duplicated request header

Maxim Dounin 875 May 31, 2011 07:58PM

Re: [PATCH] Fastcgi: core dump was caused by duplicated request header

Simon Liu 828 June 02, 2011 03:30AM

Re: [PATCH] Fastcgi: core dump was caused by duplicated request header

Maxim Dounin 840 June 02, 2011 05:54AM

Re: [PATCH] Fastcgi: core dump was caused by duplicated request header

Simon Liu 877 June 10, 2011 02:54AM

Re: [PATCH] Fastcgi: core dump was caused by duplicated request header

Simon Liu 791 June 10, 2011 04:58AM

Re: [PATCH] Fastcgi: core dump was caused by duplicated request header

Maxim Dounin 858 June 11, 2011 08:32AM

Re: [PATCH] Fastcgi: core dump was caused by duplicated request header

Simon Liu 908 June 13, 2011 10:58AM

Re: [PATCH] Fastcgi: core dump was caused by duplicated request header

Maxim Dounin 829 June 13, 2011 07:42PM

Re: [PATCH] Fastcgi: core dump was caused by duplicated request header

Simon Liu 1026 June 15, 2011 03:30AM



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

Online Users

Guests: 317
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