nginx-0.1.26-RELEASE import
*) 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.
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c
index 3876e39..461c028 100644
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -722,6 +722,7 @@
{
ssize_t n;
ngx_int_t rc, rv, i;
+ ngx_str_t header;
ngx_table_elt_t *h, **cookie;
ngx_connection_t *c;
ngx_http_request_t *r;
@@ -771,6 +772,19 @@
if (rc == NGX_OK) {
+ if (r->invalid_header) {
+
+ /* there was error while a header line parsing */
+
+ header.len = r->header_end - r->header_name_start;
+ header.data = r->header_name_start;
+
+ ngx_log_error(NGX_LOG_INFO, rev->log, 0,
+ "client sent invalid header: \"%V\", ignored,",
+ &header);
+ continue;
+ }
+
/* a header line has been parsed successfully */
r->headers_n++;
@@ -2371,6 +2385,11 @@
len -= p - buf;
+ if (ctx->request->server_name.data) {
+ p = ngx_snprintf(p, len, ", host: %V", &ctx->request->server_name);
+ len -= p - buf;
+ }
+
p = ngx_snprintf(p, len, ", URL: \"%V\"", &ctx->request->unparsed_uri);
if (ctx->request->headers_in.referer == NULL) {