summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2023-03-10 06:47:48 +0300
committerMaxim Dounin <mdounin@mdounin.ru>2023-03-10 06:47:48 +0300
commit3c949f7c409e41a7c6fd6edb096281a3e82f85e4 (patch)
tree8110367affede88ae807b27b9186fea169739d39
parent5c480f917300f8b7252e76928c12585d8d89afed (diff)
downloadnginx-3c949f7c409e41a7c6fd6edb096281a3e82f85e4.tar.gz
HTTP/2: socket leak with "return 444" in error_page (ticket #2455).
Similarly to ticket #274 (7354:1812f1d79d84), early request finalization without calling ngx_http_run_posted_requests() resulted in a connection hang (a socket leak) if the 400 (Bad Request) error was generated in ngx_http_v2_state_process_header() due to invalid request headers and "return 444" was used in error_page 400.
-rw-r--r--src/http/v2/ngx_http_v2.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/http/v2/ngx_http_v2.c b/src/http/v2/ngx_http_v2.c
index 0e45a7b27..d32c03f10 100644
--- a/src/http/v2/ngx_http_v2.c
+++ b/src/http/v2/ngx_http_v2.c
@@ -1730,6 +1730,7 @@ ngx_http_v2_state_process_header(ngx_http_v2_connection_t *h2c, u_char *pos,
size_t len;
ngx_int_t rc;
ngx_table_elt_t *h;
+ ngx_connection_t *fc;
ngx_http_header_t *hh;
ngx_http_request_t *r;
ngx_http_v2_header_t *header;
@@ -1789,6 +1790,7 @@ ngx_http_v2_state_process_header(ngx_http_v2_connection_t *h2c, u_char *pos,
}
r = h2c->state.stream->request;
+ fc = r->connection;
/* TODO Optimization: validate headers while parsing. */
if (ngx_http_v2_validate_header(r, header) != NGX_OK) {
@@ -1886,6 +1888,8 @@ error:
h2c->state.stream = NULL;
+ ngx_http_run_posted_requests(fc);
+
return ngx_http_v2_state_header_complete(h2c, pos, end);
}