aboutsummaryrefslogtreecommitdiff
path: root/src/http/ngx_http_parse.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2005-03-22 16:02:46 +0000
committerIgor Sysoev <igor@sysoev.ru>2005-03-22 16:02:46 +0000
commit4d656dcd0bd6309b0ec76fc444198ed6c2948a8e (patch)
tree67ce201b7d515273fa2a6a617542cece4fa16898 /src/http/ngx_http_parse.c
parent3599a1b885533d929315494258fb407765243a95 (diff)
downloadnginx-4d656dcd0bd6309b0ec76fc444198ed6c2948a8e.tar.gz
nginx-4d656dcd0bd6309b0ec76fc444198ed6c2948a8e.zip
nginx-0.1.26-RELEASE importrelease-0.1.26
*) Change: the invalid client header lines are now ignored and logged at the info level. *) Change: the server 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.
Diffstat (limited to 'src/http/ngx_http_parse.c')
-rw-r--r--src/http/ngx_http_parse.c34
1 files changed, 28 insertions, 6 deletions
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) {