diff options
author | Maxim Dounin <mdounin@mdounin.ru> | 2021-03-26 01:44:57 +0300 |
---|---|---|
committer | Maxim Dounin <mdounin@mdounin.ru> | 2021-03-26 01:44:57 +0300 |
commit | 1f5271cd61a102514070c0d22ce5001cf0a70d61 (patch) | |
tree | 95519e6ad75219b3a99623ad912b406beb5e4ab7 /src | |
parent | cc73d7688c315dc624282abdbbba7aec82aabad5 (diff) | |
download | nginx-1f5271cd61a102514070c0d22ce5001cf0a70d61.tar.gz nginx-1f5271cd61a102514070c0d22ce5001cf0a70d61.zip |
HTTP/2: improved handling of "keepalive_timeout 0".
Without explicit handling, a zero timer was actually added, leading to
multiple unneeded syscalls. Further, sending GOAWAY frame early might
be beneficial for clients.
Reported by Sergey Kandaurov.
Diffstat (limited to 'src')
-rw-r--r-- | src/http/v2/ngx_http_v2.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/http/v2/ngx_http_v2.c b/src/http/v2/ngx_http_v2.c index 005db0b8e..856320589 100644 --- a/src/http/v2/ngx_http_v2.c +++ b/src/http/v2/ngx_http_v2.c @@ -1368,7 +1368,9 @@ ngx_http_v2_state_headers(ngx_http_v2_connection_t *h2c, u_char *pos, clcf = ngx_http_get_module_loc_conf(h2c->http_connection->conf_ctx, ngx_http_core_module); - if (h2c->connection->requests >= clcf->keepalive_requests) { + if (clcf->keepalive_timeout == 0 + || h2c->connection->requests >= clcf->keepalive_requests) + { h2c->goaway = 1; if (ngx_http_v2_send_goaway(h2c, NGX_HTTP_V2_NO_ERROR) == NGX_ERROR) { |