]> git.kaiwu.me - nginx.git/commitdiff
Apply underscores_in_headers also to the first character.
authorPiotr Sikora <piotr@cloudflare.com>
Mon, 24 Mar 2014 23:35:44 +0000 (16:35 -0700)
committerPiotr Sikora <piotr@cloudflare.com>
Mon, 24 Mar 2014 23:35:44 +0000 (16:35 -0700)
Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
src/http/ngx_http_parse.c

index 8c1a62a7b750b9d425d94260b4125d1a180ec77e..02b4a0fd1092821050960397815f499dd321206e 100644 (file)
@@ -886,6 +886,19 @@ ngx_http_parse_header_line(ngx_http_request_t *r, ngx_buf_t *b,
                     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;
                 }