comparison src/http/v2/ngx_http_v2.c @ 6590:d375f4210e41

HTTP/2: fixed the "http request count is zero" alert. When the stream is terminated the HEADERS frame can still wait in the output queue. This frame can't be removed and must be sent to the client anyway, since HTTP/2 uses stateful compression for headers. So in order to postpone closing and freeing memory of such stream the special close stream handler is set to the write event. After the HEADERS frame is sent the write event is called and the stream will be finally closed. Some events like receiving a RST_STREAM can trigger the read handler of such stream in closing state and cause unexpected processing that can result in another attempt to finalize the request. To prevent it the read handler is now set to ngx_http_empty_handler. Thanks to Amazon.
author Valentin Bartenev <vbart@nginx.com>
date Thu, 16 Jun 2016 20:55:11 +0300
parents 78533a74af11
children ea284434db0f
comparison
equal deleted inserted replaced
6589:78533a74af11 6590:d375f4210e41
3933 3933
3934 fc = stream->request->connection; 3934 fc = stream->request->connection;
3935 3935
3936 if (stream->queued) { 3936 if (stream->queued) {
3937 fc->write->handler = ngx_http_v2_close_stream_handler; 3937 fc->write->handler = ngx_http_v2_close_stream_handler;
3938 fc->read->handler = ngx_http_empty_handler;
3938 return; 3939 return;
3939 } 3940 }
3940 3941
3941 if (!stream->rst_sent && !h2c->connection->error) { 3942 if (!stream->rst_sent && !h2c->connection->error) {
3942 3943