diff src/http/ngx_http_request.c @ 52:0d75d65c642f NGINX_0_1_26

nginx 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.
author Igor Sysoev <http://sysoev.ru>
date Tue, 22 Mar 2005 00:00:00 +0300
parents 72eb30262aac
children bcb5fce0b038
line wrap: on
line diff
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -722,6 +722,7 @@ ngx_http_process_request_headers(ngx_eve
 {
     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 @@ ngx_http_process_request_headers(ngx_eve
 
         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 @@ ngx_http_log_error(ngx_log_t *log, u_cha
 
     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) {