]> git.kaiwu.me - nginx.git/commitdiff
HTTP/2: return error on output on closed stream.
authorMaxim Dounin <mdounin@mdounin.ru>
Thu, 18 Jul 2019 15:27:50 +0000 (18:27 +0300)
committerMaxim Dounin <mdounin@mdounin.ru>
Thu, 18 Jul 2019 15:27:50 +0000 (18:27 +0300)
Without this, an (incorrect) output on a closed stream could result in
a socket leak.

src/http/v2/ngx_http_v2_filter_module.c

index 853faefd31efbd699ce1a96d4415bb7d26ad2783..81e6c513aa63ffc1da1455118be1335a795569b3 100644 (file)
@@ -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;