changeset 6753:20485a482bc0 stable-1.10

HTTP/2: prevented double termination of a stream. According to RFC 7540, an endpoint should not send more than one RST_STREAM frame for any stream. Also, now all the data frames will be skipped while termination.
author Valentin Bartenev <vbart@nginx.com>
date Thu, 16 Jun 2016 20:55:11 +0300
parents 0708285115fa
children 12b1df4c9944
files src/http/v2/ngx_http_v2.c
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/http/v2/ngx_http_v2.c
+++ b/src/http/v2/ngx_http_v2.c
@@ -3890,6 +3890,10 @@ ngx_http_v2_terminate_stream(ngx_http_v2
     ngx_event_t       *rev;
     ngx_connection_t  *fc;
 
+    if (stream->rst_sent) {
+        return NGX_OK;
+    }
+
     if (ngx_http_v2_send_rst_stream(h2c, stream->node->id, status)
         == NGX_ERROR)
     {
@@ -3897,6 +3901,7 @@ ngx_http_v2_terminate_stream(ngx_http_v2
     }
 
     stream->rst_sent = 1;
+    stream->skip_data = 1;
 
     fc = stream->request->connection;
     fc->error = 1;