[nginx] Fixed header parsing with ignore_invalid_headers switched off.

Ruslan Ermilov ru at nginx.com
Tue Oct 15 11:46:44 UTC 2019


details:   https://hg.nginx.org/nginx/rev/8f55cb5c7e79
branches:  
changeset: 7580:8f55cb5c7e79
user:      Ruslan Ermilov <ru at nginx.com>
date:      Tue Oct 15 14:46:10 2019 +0300
description:
Fixed header parsing with ignore_invalid_headers switched off.

The parsing was broken when the first character of the header name was invalid.

Based on a patch by Alan Kemp.

diffstat:

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

diffs (21 lines):

diff -r 6208c5418c88 -r 8f55cb5c7e79 src/http/ngx_http_parse.c
--- a/src/http/ngx_http_parse.c	Tue Oct 08 21:56:14 2019 +0300
+++ b/src/http/ngx_http_parse.c	Tue Oct 15 14:46:10 2019 +0300
@@ -912,6 +912,8 @@ ngx_http_parse_header_line(ngx_http_requ
                         i = 1;
 
                     } else {
+                        hash = 0;
+                        i = 0;
                         r->invalid_header = 1;
                     }
 
@@ -922,6 +924,8 @@ ngx_http_parse_header_line(ngx_http_requ
                     return NGX_HTTP_PARSE_INVALID_HEADER;
                 }
 
+                hash = 0;
+                i = 0;
                 r->invalid_header = 1;
 
                 break;


More information about the nginx-devel mailing list