Welcome! Log In Create A New Profile

Advanced

[nginx] HTTP/2: client_header_timeout before first request (ticket #2142).

Maxim Dounin
March 01, 2021 11:58AM
details: https://hg.nginx.org/nginx/rev/171682010da4
branches:
changeset: 7783:171682010da4
user: Maxim Dounin <mdounin@mdounin.ru>
date: Mon Mar 01 17:31:28 2021 +0300
description:
HTTP/2: client_header_timeout before first request (ticket #2142).

With this change, behaviour of HTTP/2 becomes even closer to HTTP/1.x,
and client_header_timeout instead of keepalive_timeout is used before
the first request is received.

This fixes HTTP/2 connections being closed even before the first request
if "keepalive_timeout 0;" was used in the configuration; the problem
appeared in f790816a0e87 (1.19.7).

diffstat:

src/http/v2/ngx_http_v2.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)

diffs (24 lines):

diff -r dea93b6dce94 -r 171682010da4 src/http/v2/ngx_http_v2.c
--- a/src/http/v2/ngx_http_v2.c Thu Feb 25 23:42:25 2021 +0300
+++ b/src/http/v2/ngx_http_v2.c Mon Mar 01 17:31:28 2021 +0300
@@ -238,6 +238,7 @@ ngx_http_v2_init(ngx_event_t *rev)
ngx_http_v2_srv_conf_t *h2scf;
ngx_http_v2_main_conf_t *h2mcf;
ngx_http_v2_connection_t *h2c;
+ ngx_http_core_srv_conf_t *cscf;

c = rev->data;
hc = c->data;
@@ -325,8 +326,10 @@ ngx_http_v2_init(ngx_event_t *rev)
rev->handler = ngx_http_v2_read_handler;
c->write->handler = ngx_http_v2_write_handler;

- if (c->read->timer_set) {
- ngx_del_timer(c->read);
+ if (!rev->timer_set) {
+ cscf = ngx_http_get_module_srv_conf(hc->conf_ctx,
+ ngx_http_core_module);
+ ngx_add_timer(rev, cscf->client_header_timeout);
}

c->idle = 1;
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] HTTP/2: client_header_timeout before first request (ticket #2142).

Maxim Dounin 250 March 01, 2021 11:58AM



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

Online Users

Guests: 180
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready