comparison src/http/v3/ngx_http_v3_streams.c @ 8549:054f9be0aaf9 quic

HTTP/3: http3_max_uni_streams directive. The directive limits the number of uni streams client is allowed to create.
author Roman Arutyunyan <arut@nginx.com>
date Thu, 29 Jul 2021 12:17:56 +0300
parents d80365ca678d
children d6e191a583cc
comparison
equal deleted inserted replaced
8548:f3331deed357 8549:054f9be0aaf9
33 33
34 34
35 void 35 void
36 ngx_http_v3_init_uni_stream(ngx_connection_t *c) 36 ngx_http_v3_init_uni_stream(ngx_connection_t *c)
37 { 37 {
38 uint64_t n;
39 ngx_http_v3_srv_conf_t *h3scf;
38 ngx_http_v3_uni_stream_t *us; 40 ngx_http_v3_uni_stream_t *us;
39 41
40 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 init uni stream"); 42 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 init uni stream");
43
44 h3scf = ngx_http_v3_get_module_srv_conf(c, ngx_http_v3_module);
45
46 n = c->quic->id >> 2;
47
48 if (n >= h3scf->max_uni_streams) {
49 ngx_http_v3_finalize_connection(c,
50 NGX_HTTP_V3_ERR_STREAM_CREATION_ERROR,
51 "reached maximum number of uni streams");
52 ngx_http_close_connection(c);
53 return;
54 }
41 55
42 c->quic->cancelable = 1; 56 c->quic->cancelable = 1;
43 57
44 us = ngx_pcalloc(c->pool, sizeof(ngx_http_v3_uni_stream_t)); 58 us = ngx_pcalloc(c->pool, sizeof(ngx_http_v3_uni_stream_t));
45 if (us == NULL) { 59 if (us == NULL) {