diff options
author | Maxim Dounin <mdounin@mdounin.ru> | 2021-06-28 18:01:20 +0300 |
---|---|---|
committer | Maxim Dounin <mdounin@mdounin.ru> | 2021-06-28 18:01:20 +0300 |
commit | 7587778a33bea0ce6f203a8c4de18e33f38b9582 (patch) | |
tree | a0d639abed07bc85bc99efb5609333494d9f496f /src/http/ngx_http_request.c | |
parent | 9ab4d368af63e9c4a0bebc0eda82d668adaa560a (diff) | |
download | nginx-7587778a33bea0ce6f203a8c4de18e33f38b9582.tar.gz nginx-7587778a33bea0ce6f203a8c4de18e33f38b9582.zip |
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.
Diffstat (limited to 'src/http/ngx_http_request.c')
-rw-r--r-- | src/http/ngx_http_request.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c index 7956610c4..2e7c30fb6 100644 --- a/src/http/ngx_http_request.c +++ b/src/http/ngx_http_request.c @@ -1522,7 +1522,9 @@ ngx_http_process_request_headers(ngx_event_t *rev) /* rc == NGX_HTTP_PARSE_INVALID_HEADER */ ngx_log_error(NGX_LOG_INFO, c->log, 0, - "client sent invalid header line"); + "client sent invalid header line: \"%*s\\x%02xd...\"", + r->header_end - r->header_name_start, + r->header_name_start, *r->header_end); ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST); break; |