Welcome! Log In Create A New Profile

Advanced

[nginx] HTTP/2: close connection on zero WINDOW_UPDATE.

September 10, 2019 10:38AM
details: https://hg.nginx.org/nginx/rev/fd6dcc6f8a49
branches:
changeset: 7565:fd6dcc6f8a49
user: Ruslan Ermilov <ru@nginx.com>
date: Tue Sep 10 15:33:38 2019 +0300
description:
HTTP/2: close connection on zero WINDOW_UPDATE.

Don't waste server resources by sending RST_STREAM frames. Instead,
reject WINDOW_UPDATE frames with invalid zero increment by closing
connection with PROTOCOL_ERROR.

diffstat:

src/http/v2/ngx_http_v2.c | 38 ++++----------------------------------
1 files changed, 4 insertions(+), 34 deletions(-)

diffs (49 lines):

diff -r 29b2dc731503 -r fd6dcc6f8a49 src/http/v2/ngx_http_v2.c
--- a/src/http/v2/ngx_http_v2.c Tue Sep 10 15:33:37 2019 +0300
+++ b/src/http/v2/ngx_http_v2.c Tue Sep 10 15:33:38 2019 +0300
@@ -2231,41 +2231,11 @@ ngx_http_v2_state_window_update(ngx_http
h2c->state.sid, window);

if (window == 0) {
- if (h2c->state.sid == 0) {
- ngx_log_error(NGX_LOG_INFO, h2c->connection->log, 0,
- "client sent WINDOW_UPDATE frame "
- "with incorrect window increment 0");
-
- return ngx_http_v2_connection_error(h2c,
- NGX_HTTP_V2_PROTOCOL_ERROR);
- }
-
ngx_log_error(NGX_LOG_INFO, h2c->connection->log, 0,
- "client sent WINDOW_UPDATE frame for stream %ui "
- "with incorrect window increment 0", h2c->state.sid);
-
- node = ngx_http_v2_get_node_by_id(h2c, h2c->state.sid, 0);
-
- if (node && node->stream) {
- if (ngx_http_v2_terminate_stream(h2c, node->stream,
- NGX_HTTP_V2_PROTOCOL_ERROR)
- == NGX_ERROR)
- {
- return ngx_http_v2_connection_error(h2c,
- NGX_HTTP_V2_INTERNAL_ERROR);
- }
-
- } else {
- if (ngx_http_v2_send_rst_stream(h2c, h2c->state.sid,
- NGX_HTTP_V2_PROTOCOL_ERROR)
- == NGX_ERROR)
- {
- return ngx_http_v2_connection_error(h2c,
- NGX_HTTP_V2_INTERNAL_ERROR);
- }
- }
-
- return ngx_http_v2_state_complete(h2c, pos, end);
+ "client sent WINDOW_UPDATE frame "
+ "with incorrect window increment 0");
+
+ return ngx_http_v2_connection_error(h2c, NGX_HTTP_V2_PROTOCOL_ERROR);
}

if (h2c->state.sid) {
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] HTTP/2: close connection on zero WINDOW_UPDATE.

ru@nginx.com 86 September 10, 2019 10:38AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 107
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready