comparison src/http/ngx_http_request.c @ 7884:b87b7092cedb

Improved logging of invalid headers. In 71edd9192f24 logging of invalid headers which were rejected with the NGX_HTTP_PARSE_INVALID_HEADER error was restricted to just the "client sent invalid header line" message, without any attempts to log the header itself. This patch returns logging of the header up to the invalid character and the character itself. The r->header_end pointer is now properly set in all cases to make logging possible. The same logging is also introduced when parsing headers from upstream servers.
author Maxim Dounin <mdounin@mdounin.ru>
date Mon, 28 Jun 2021 18:01:20 +0300
parents 52338ddf9e2f
children e0fdd75871e4
comparison
equal deleted inserted replaced
7883:41f4bd4c51f1 7884:b87b7092cedb
1520 } 1520 }
1521 1521
1522 /* rc == NGX_HTTP_PARSE_INVALID_HEADER */ 1522 /* rc == NGX_HTTP_PARSE_INVALID_HEADER */
1523 1523
1524 ngx_log_error(NGX_LOG_INFO, c->log, 0, 1524 ngx_log_error(NGX_LOG_INFO, c->log, 0,
1525 "client sent invalid header line"); 1525 "client sent invalid header line: \"%*s\\x%02xd...\"",
1526 r->header_end - r->header_name_start,
1527 r->header_name_start, *r->header_end);
1526 1528
1527 ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST); 1529 ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
1528 break; 1530 break;
1529 } 1531 }
1530 1532