Skip to content

Commit

Permalink
Fixed header parsing with ignore_invalid_headers switched off.
Browse files Browse the repository at this point in the history
The parsing was broken when the first character of the header name was invalid.

Based on a patch by Alan Kemp.
  • Loading branch information
mdocguard committed Oct 15, 2019
1 parent 85137dd commit 3c84e4b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/http/ngx_http_parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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;
Expand Down

0 comments on commit 3c84e4b

Please sign in to comment.