From 766b94b670a551c0a881dad06f7bc404c51607ee Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Tue, 22 Mar 2005 16:11:23 +0000 Subject: Changes with nginx 0.1.26 22 Mar 2005 *) Change: the invalid client header lines are now ignored and logged at the info level. *) Change: the host name is also logged in error log. *) Feature: the ngx_http_auth_basic_module module and the auth_basic and auth_basic_user_file directives. --- src/http/ngx_http_parse.c | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) (limited to 'src/http/ngx_http_parse.c') diff --git a/src/http/ngx_http_parse.c b/src/http/ngx_http_parse.c index a7d8fe37f..7f031cf0d 100644 --- a/src/http/ngx_http_parse.c +++ b/src/http/ngx_http_parse.c @@ -497,9 +497,10 @@ ngx_int_t ngx_http_parse_header_line(ngx_http_request_t *r, ngx_buf_t *b) sw_space_before_value, sw_value, sw_space_after_value, + sw_ignore_line, + sw_skip_line, sw_almost_done, - sw_header_almost_done, - sw_ignore_line + sw_header_almost_done } state; state = r->state; @@ -511,6 +512,8 @@ ngx_int_t ngx_http_parse_header_line(ngx_http_request_t *r, ngx_buf_t *b) /* first char */ case sw_start: + r->invalid_header = 0; + switch (ch) { case CR: r->header_end = p; @@ -528,7 +531,7 @@ ngx_int_t ngx_http_parse_header_line(ngx_http_request_t *r, ngx_buf_t *b) break; } - if (ch == '-' || ch == '_' || ch == '~' || ch == '.') { + if (ch == '-') { break; } @@ -536,7 +539,9 @@ ngx_int_t ngx_http_parse_header_line(ngx_http_request_t *r, ngx_buf_t *b) break; } - return NGX_HTTP_PARSE_INVALID_HEADER; + r->invalid_header = 1; + state = sw_skip_line; + break; } break; @@ -554,7 +559,7 @@ ngx_int_t ngx_http_parse_header_line(ngx_http_request_t *r, ngx_buf_t *b) break; } - if (ch == '-' || ch == '_' || ch == '~' || ch == '.') { + if (ch == '-') { break; } @@ -572,7 +577,9 @@ ngx_int_t ngx_http_parse_header_line(ngx_http_request_t *r, ngx_buf_t *b) break; } - return NGX_HTTP_PARSE_INVALID_HEADER; + r->invalid_header = 1; + state = sw_skip_line; + break; /* space* before header value */ case sw_space_before_value: @@ -637,6 +644,21 @@ ngx_int_t ngx_http_parse_header_line(ngx_http_request_t *r, ngx_buf_t *b) } break; + /* skip header line */ + case sw_skip_line: + switch (ch) { + case CR: + r->header_end = p; + state = sw_almost_done; + break; + case LF: + r->header_end = p; + goto done; + default: + break; + } + break; + /* end of header line */ case sw_almost_done: switch (ch) { -- cgit v1.2.1