comparison src/http/v2/ngx_http_v2.c @ 8148:9db24374123b

HTTP/2: finalize request as bad if header validation fails. Similarly to 7192:d5a535774861, this avoids spurious zero statuses in access.log, and in line with other header-related errors.
author Maxim Dounin <mdounin@mdounin.ru>
date Fri, 10 Mar 2023 06:47:53 +0300
parents 72627f1cf09e
children 08ef02ad5c54
comparison
equal deleted inserted replaced
8147:72627f1cf09e 8148:9db24374123b
1792 r = h2c->state.stream->request; 1792 r = h2c->state.stream->request;
1793 fc = r->connection; 1793 fc = r->connection;
1794 1794
1795 /* TODO Optimization: validate headers while parsing. */ 1795 /* TODO Optimization: validate headers while parsing. */
1796 if (ngx_http_v2_validate_header(r, header) != NGX_OK) { 1796 if (ngx_http_v2_validate_header(r, header) != NGX_OK) {
1797 if (ngx_http_v2_terminate_stream(h2c, h2c->state.stream, 1797 ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
1798 NGX_HTTP_V2_PROTOCOL_ERROR)
1799 == NGX_ERROR)
1800 {
1801 return ngx_http_v2_connection_error(h2c,
1802 NGX_HTTP_V2_INTERNAL_ERROR);
1803 }
1804
1805 goto error; 1798 goto error;
1806 } 1799 }
1807 1800
1808 if (header->name.data[0] == ':') { 1801 if (header->name.data[0] == ':') {
1809 rc = ngx_http_v2_pseudo_header(r, header); 1802 rc = ngx_http_v2_pseudo_header(r, header);