comparison src/http/modules/ngx_http_uwsgi_module.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 3ab8e1e2f0f7
children 419c066cb710
comparison
equal deleted inserted replaced
7883:41f4bd4c51f1 7884:b87b7092cedb
1359 1359
1360 if (rc == NGX_AGAIN) { 1360 if (rc == NGX_AGAIN) {
1361 return NGX_AGAIN; 1361 return NGX_AGAIN;
1362 } 1362 }
1363 1363
1364 /* there was error while a header line parsing */ 1364 /* rc == NGX_HTTP_PARSE_INVALID_HEADER */
1365 1365
1366 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, 1366 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
1367 "upstream sent invalid header"); 1367 "upstream sent invalid header: \"%*s\\x%02xd...\"",
1368 r->header_end - r->header_name_start,
1369 r->header_name_start, *r->header_end);
1368 1370
1369 return NGX_HTTP_UPSTREAM_INVALID_HEADER; 1371 return NGX_HTTP_UPSTREAM_INVALID_HEADER;
1370 } 1372 }
1371 } 1373 }
1372 1374