diff options
author | Roman Arutyunyan <arut@nginx.com> | 2021-07-29 12:17:56 +0300 |
---|---|---|
committer | Roman Arutyunyan <arut@nginx.com> | 2021-07-29 12:17:56 +0300 |
commit | 2f833198b8229842dbbc57f7e86b00b19ed3b294 (patch) | |
tree | 9dd5a834dd87b8b77d879906018179df6dd43a7d /src/http/v3/ngx_http_v3_streams.c | |
parent | 7a8fa1182812cd2408f2fe404b3ec6de35b9299c (diff) | |
download | nginx-2f833198b8229842dbbc57f7e86b00b19ed3b294.tar.gz nginx-2f833198b8229842dbbc57f7e86b00b19ed3b294.zip |
HTTP/3: http3_max_uni_streams directive.
The directive limits the number of uni streams client is allowed to create.
Diffstat (limited to 'src/http/v3/ngx_http_v3_streams.c')
-rw-r--r-- | src/http/v3/ngx_http_v3_streams.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/http/v3/ngx_http_v3_streams.c b/src/http/v3/ngx_http_v3_streams.c index 693225b89..1b0f91454 100644 --- a/src/http/v3/ngx_http_v3_streams.c +++ b/src/http/v3/ngx_http_v3_streams.c @@ -35,10 +35,24 @@ static ngx_connection_t *ngx_http_v3_get_uni_stream(ngx_connection_t *c, void ngx_http_v3_init_uni_stream(ngx_connection_t *c) { + uint64_t n; + ngx_http_v3_srv_conf_t *h3scf; ngx_http_v3_uni_stream_t *us; ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 init uni stream"); + h3scf = ngx_http_v3_get_module_srv_conf(c, ngx_http_v3_module); + + n = c->quic->id >> 2; + + if (n >= h3scf->max_uni_streams) { + ngx_http_v3_finalize_connection(c, + NGX_HTTP_V3_ERR_STREAM_CREATION_ERROR, + "reached maximum number of uni streams"); + ngx_http_close_connection(c); + return; + } + c->quic->cancelable = 1; us = ngx_pcalloc(c->pool, sizeof(ngx_http_v3_uni_stream_t)); |