diff options
author | Maxim Dounin <mdounin@mdounin.ru> | 2021-03-01 17:31:28 +0300 |
---|---|---|
committer | Maxim Dounin <mdounin@mdounin.ru> | 2021-03-01 17:31:28 +0300 |
commit | 0f5d0c5798eacb60407bcf0a76fc0b2c39e356bb (patch) | |
tree | 04b6bd0f49dcae1b36aadf561d55343465d79ad1 /src | |
parent | a74961f5529a79fed9cad66a04de98711705d6fd (diff) | |
download | nginx-0f5d0c5798eacb60407bcf0a76fc0b2c39e356bb.tar.gz nginx-0f5d0c5798eacb60407bcf0a76fc0b2c39e356bb.zip |
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 (limited to 'src')
-rw-r--r-- | src/http/v2/ngx_http_v2.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/http/v2/ngx_http_v2.c b/src/http/v2/ngx_http_v2.c index a59528494..005db0b8e 100644 --- a/src/http/v2/ngx_http_v2.c +++ b/src/http/v2/ngx_http_v2.c @@ -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; |