]> git.kaiwu.me - nginx.git/commitdiff
Fixed header parsing with ignore_invalid_headers switched off.
authorRuslan Ermilov <ru@nginx.com>
Tue, 15 Oct 2019 11:46:10 +0000 (14:46 +0300)
committerRuslan Ermilov <ru@nginx.com>
Tue, 15 Oct 2019 11:46:10 +0000 (14:46 +0300)
The parsing was broken when the first character of the header name was invalid.

Based on a patch by Alan Kemp.

src/http/ngx_http_parse.c

index aa56b976df355db38b9c062ef6751a5568997973..cfc42f9ddca2fbd223a3bae27ec0393f30ebf024 100644 (file)
@@ -912,6 +912,8 @@ ngx_http_parse_header_line(ngx_http_request_t *r, ngx_buf_t *b,
                         i = 1;
 
                     } else {
+                        hash = 0;
+                        i = 0;
                         r->invalid_header = 1;
                     }
 
@@ -922,6 +924,8 @@ ngx_http_parse_header_line(ngx_http_request_t *r, ngx_buf_t *b,
                     return NGX_HTTP_PARSE_INVALID_HEADER;
                 }
 
+                hash = 0;
+                i = 0;
                 r->invalid_header = 1;
 
                 break;