From 36dfa020f256dfc5beed3366be099d99543ad5b2 Mon Sep 17 00:00:00 2001 From: Maxim Dounin Date: Thu, 18 Jul 2019 18:27:50 +0300 Subject: HTTP/2: return error on output on closed stream. Without this, an (incorrect) output on a closed stream could result in a socket leak. --- src/http/v2/ngx_http_v2_filter_module.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/http/v2') diff --git a/src/http/v2/ngx_http_v2_filter_module.c b/src/http/v2/ngx_http_v2_filter_module.c index 853faefd3..81e6c513a 100644 --- a/src/http/v2/ngx_http_v2_filter_module.c +++ b/src/http/v2/ngx_http_v2_filter_module.c @@ -1444,6 +1444,12 @@ ngx_http_v2_send_chain(ngx_connection_t *fc, ngx_chain_t *in, off_t limit) if (in == NULL || stream->out_closed) { + if (size) { + ngx_log_error(NGX_LOG_ERR, fc->log, 0, + "output on closed stream"); + return NGX_CHAIN_ERROR; + } + if (stream->queued) { fc->write->active = 1; fc->write->ready = 0; -- cgit