aboutsummaryrefslogtreecommitdiff
path: root/src/http/v2/ngx_http_v2.c
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2021-02-11 21:52:17 +0300
committerMaxim Dounin <mdounin@mdounin.ru>2021-02-11 21:52:17 +0300
commit797a2dc7cf970d2ee7523ec1f276156c5ea16b01 (patch)
tree47ab9137218e2d1e632e36f9021c6878f63449d0 /src/http/v2/ngx_http_v2.c
parent76672e6500c1a51905c9366f7c833ea58f351bc4 (diff)
downloadnginx-797a2dc7cf970d2ee7523ec1f276156c5ea16b01.tar.gz
nginx-797a2dc7cf970d2ee7523ec1f276156c5ea16b01.zip
HTTP/2: fixed reusing connections with active requests.
New connections are marked reusable by ngx_http_init_connection() if there are no data available for reading. As a result, if SSL is not used, ngx_http_v2_init() might be called when the connection is marked reusable. If a HEADERS frame is immediately available for reading, this resulted in connection being preserved in reusable state with an active request, and possibly closed later as if during worker shutdown (that is, after all active requests were finalized). Fix is to explicitly mark connections non-reusable in ngx_http_v2_init() instead of (incorrectly) assuming they are already non-reusable. Found by Sergey Kandaurov.
Diffstat (limited to 'src/http/v2/ngx_http_v2.c')
-rw-r--r--src/http/v2/ngx_http_v2.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/http/v2/ngx_http_v2.c b/src/http/v2/ngx_http_v2.c
index df78576df..5482ea63e 100644
--- a/src/http/v2/ngx_http_v2.c
+++ b/src/http/v2/ngx_http_v2.c
@@ -326,6 +326,7 @@ ngx_http_v2_init(ngx_event_t *rev)
c->write->handler = ngx_http_v2_write_handler;
c->idle = 1;
+ ngx_reusable_connection(c, 0);
ngx_http_v2_read_handler(rev);
}