Welcome! Log In Create A New Profile

Advanced

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

Piotr Sikora
March 24, 2014 07:50PM
Hey Maxim,

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

Done.

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

Done.

> - is it something really needed in practice?

Well, I'm not a fan of allowing underscores in the headers in the
first place, but since this is already in nginx, I don't see a reason
why this directive should allow underscores anywhere in the header
name, but not in the first character...

And yes, we have customers proxying headers starting with an underscore.

> Should be
>
> hash = ngx_hash(0, ch);
>
> instead.

Good catch, thanks!

Best regards,
Piotr Sikora


# HG changeset patch
# User Piotr Sikora <piotr@cloudflare.com>
# Date 1395704144 25200
# Mon Mar 24 16:35:44 2014 -0700
# Node ID 9b71aa40b65135ed65c5f39c54a743a417ac77e8
# Parent a23c35496c2fc0ba9a34d968c2ca6d1f9374f8a8
Apply underscores_in_headers also to the first character.

Signed-off-by: Piotr Sikora <piotr@cloudflare.com>

diff -r a23c35496c2f -r 9b71aa40b651 src/http/ngx_http_parse.c
--- a/src/http/ngx_http_parse.c Mon Mar 24 17:55:10 2014 +0400
+++ b/src/http/ngx_http_parse.c Mon Mar 24 16:35:44 2014 -0700
@@ -886,6 +886,19 @@ ngx_http_parse_header_line(ngx_http_requ
break;
}

+ if (ch == '_') {
+ if (allow_underscores) {
+ hash = ngx_hash(0, ch);
+ 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@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

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

Piotr Sikora 684 March 19, 2014 09:58PM

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

Maxim Dounin 328 March 21, 2014 01:14PM

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

Piotr Sikora 319 March 24, 2014 07:50PM

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

Maxim Dounin 354 March 25, 2014 12:16PM



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

Online Users

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