[nginx] Apply underscores_in_headers also to the first character.

Maxim Dounin mdounin at mdounin.ru
Tue Mar 25 16:14:51 UTC 2014


details:   http://hg.nginx.org/nginx/rev/bd91f286ee0a
branches:  
changeset: 5624:bd91f286ee0a
user:      Piotr Sikora <piotr at cloudflare.com>
date:      Mon Mar 24 16:35:44 2014 -0700
description:
Apply underscores_in_headers also to the first character.

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

diffstat:

 src/http/ngx_http_parse.c |  13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diffs (23 lines):

diff --git a/src/http/ngx_http_parse.c b/src/http/ngx_http_parse.c
--- a/src/http/ngx_http_parse.c
+++ b/src/http/ngx_http_parse.c
@@ -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;
                 }



More information about the nginx-devel mailing list