comparison src/http/v2/ngx_http_v2_module.c @ 7771:02be1baed382

HTTP/2: removed http2_recv_timeout. Instead, the client_header_timeout is now used for HTTP/2 reading. Further, the timeout is changed to be set once till no further data left to read, similarly to how client_header_timeout is used in other places.
author Maxim Dounin <mdounin@mdounin.ru>
date Thu, 11 Feb 2021 21:52:20 +0300
parents de0b6f1fe4e4
children f790816a0e87
comparison
equal deleted inserted replaced
7770:de0b6f1fe4e4 7771:02be1baed382
34 static char *ngx_http_v2_pool_size(ngx_conf_t *cf, void *post, void *data); 34 static char *ngx_http_v2_pool_size(ngx_conf_t *cf, void *post, void *data);
35 static char *ngx_http_v2_preread_size(ngx_conf_t *cf, void *post, void *data); 35 static char *ngx_http_v2_preread_size(ngx_conf_t *cf, void *post, void *data);
36 static char *ngx_http_v2_streams_index_mask(ngx_conf_t *cf, void *post, 36 static char *ngx_http_v2_streams_index_mask(ngx_conf_t *cf, void *post,
37 void *data); 37 void *data);
38 static char *ngx_http_v2_chunk_size(ngx_conf_t *cf, void *post, void *data); 38 static char *ngx_http_v2_chunk_size(ngx_conf_t *cf, void *post, void *data);
39 static char *ngx_http_v2_obsolete(ngx_conf_t *cf, ngx_command_t *cmd,
40 void *conf);
41
42
43 static ngx_conf_deprecated_t ngx_http_v2_recv_timeout_deprecated = {
44 ngx_conf_deprecated, "http2_recv_timeout", "client_header_timeout"
45 };
39 46
40 47
41 static ngx_conf_post_t ngx_http_v2_recv_buffer_size_post = 48 static ngx_conf_post_t ngx_http_v2_recv_buffer_size_post =
42 { ngx_http_v2_recv_buffer_size }; 49 { ngx_http_v2_recv_buffer_size };
43 static ngx_conf_post_t ngx_http_v2_pool_size_post = 50 static ngx_conf_post_t ngx_http_v2_pool_size_post =
115 offsetof(ngx_http_v2_srv_conf_t, streams_index_mask), 122 offsetof(ngx_http_v2_srv_conf_t, streams_index_mask),
116 &ngx_http_v2_streams_index_mask_post }, 123 &ngx_http_v2_streams_index_mask_post },
117 124
118 { ngx_string("http2_recv_timeout"), 125 { ngx_string("http2_recv_timeout"),
119 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1, 126 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1,
120 ngx_conf_set_msec_slot, 127 ngx_http_v2_obsolete,
121 NGX_HTTP_SRV_CONF_OFFSET, 128 0,
122 offsetof(ngx_http_v2_srv_conf_t, recv_timeout), 129 0,
123 NULL }, 130 &ngx_http_v2_recv_timeout_deprecated },
124 131
125 { ngx_string("http2_idle_timeout"), 132 { ngx_string("http2_idle_timeout"),
126 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1, 133 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1,
127 ngx_conf_set_msec_slot, 134 ngx_conf_set_msec_slot,
128 NGX_HTTP_SRV_CONF_OFFSET, 135 NGX_HTTP_SRV_CONF_OFFSET,
302 309
303 h2scf->preread_size = NGX_CONF_UNSET_SIZE; 310 h2scf->preread_size = NGX_CONF_UNSET_SIZE;
304 311
305 h2scf->streams_index_mask = NGX_CONF_UNSET_UINT; 312 h2scf->streams_index_mask = NGX_CONF_UNSET_UINT;
306 313
307 h2scf->recv_timeout = NGX_CONF_UNSET_MSEC;
308 h2scf->idle_timeout = NGX_CONF_UNSET_MSEC; 314 h2scf->idle_timeout = NGX_CONF_UNSET_MSEC;
309 315
310 return h2scf; 316 return h2scf;
311 } 317 }
312 318
333 ngx_conf_merge_size_value(conf->preread_size, prev->preread_size, 65536); 339 ngx_conf_merge_size_value(conf->preread_size, prev->preread_size, 65536);
334 340
335 ngx_conf_merge_uint_value(conf->streams_index_mask, 341 ngx_conf_merge_uint_value(conf->streams_index_mask,
336 prev->streams_index_mask, 32 - 1); 342 prev->streams_index_mask, 32 - 1);
337 343
338 ngx_conf_merge_msec_value(conf->recv_timeout,
339 prev->recv_timeout, 30000);
340 ngx_conf_merge_msec_value(conf->idle_timeout, 344 ngx_conf_merge_msec_value(conf->idle_timeout,
341 prev->idle_timeout, 180000); 345 prev->idle_timeout, 180000);
342 346
343 return NGX_CONF_OK; 347 return NGX_CONF_OK;
344 } 348 }
537 *sp = NGX_HTTP_V2_MAX_FRAME_SIZE; 541 *sp = NGX_HTTP_V2_MAX_FRAME_SIZE;
538 } 542 }
539 543
540 return NGX_CONF_OK; 544 return NGX_CONF_OK;
541 } 545 }
546
547
548 static char *
549 ngx_http_v2_obsolete(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
550 {
551 ngx_conf_deprecated_t *d = cmd->post;
552
553 ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
554 "the \"%s\" directive is obsolete, "
555 "use the \"%s\" directive instead",
556 d->old_name, d->new_name);
557
558 return NGX_CONF_OK;
559 }