[PATCH] Parse: underscores_in_headers should apply to the first character as well

Maxim Dounin mdounin at mdounin.ru
Fri Mar 21 17:12:21 UTC 2014


Hello!

On Wed, Mar 19, 2014 at 06:56:10PM -0700, Piotr Sikora wrote:

> # HG changeset patch
> # User Piotr Sikora <piotr at cloudflare.com>
> # Date 1395280497 25200
> #      Wed Mar 19 18:54:57 2014 -0700
> # Node ID 51d996a6bc65c4ca3c6621e4ad18235e6aa26abe
> # Parent  c15350f4071c0207cdffbc8bbb3f28e8e57f4d86
> Parse: underscores_in_headers should apply to the first character as well.

In no particular order:

- the "Parse:" prefix isn't something we use, it may be good idea 
  to avoid id;

- please keep summary line short to avoid "hg log" wrapping, see 
  http://nginx.org/en/docs/contributing_changes.html;

- is it something really needed in practice?

> 
> Signed-off-by: Piotr Sikora <piotr at cloudflare.com>
> 
> diff -r c15350f4071c -r 51d996a6bc65 src/http/ngx_http_parse.c
> --- a/src/http/ngx_http_parse.c	Wed Mar 19 19:30:09 2014 +0400
> +++ b/src/http/ngx_http_parse.c	Wed Mar 19 18:54:57 2014 -0700
> @@ -886,6 +886,19 @@ ngx_http_parse_header_line(ngx_http_requ
>                      break;
>                  }
>  
> +                if (ch == '_') {
> +                    if (allow_underscores) {
> +                        hash = ngx_hash(hash, ch);

Should be

                           hash = ngx_hash(0, ch);

instead.

> +                        r->lowcase_header[0] = ch;
> +                        i = 1;
> +
> +                    } else {
> +                        r->invalid_header = 1;
> +                    }
> +
> +                    break;
> +                }
> +
>                  if (ch == '\0') {
>                      return NGX_HTTP_PARSE_INVALID_HEADER;
>                  }
> 
> _______________________________________________
> nginx-devel mailing list
> nginx-devel at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-devel

-- 
Maxim Dounin
http://nginx.org/



More information about the nginx-devel mailing list