Mercurial > hg > nginx-quic
comparison src/http/v3/ngx_http_v3_streams.c @ 8546:d80365ca678d quic
HTTP/3: require mandatory uni streams before additional ones.
As per quic-http-34:
Endpoints SHOULD create the HTTP control stream as well as the
unidirectional streams required by mandatory extensions (such as the
QPACK encoder and decoder streams) first, and then create additional
streams as allowed by their peer.
Previously, client could create and destroy additional uni streams unlimited
number of times before creating mandatory streams.
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Thu, 29 Jul 2021 10:03:36 +0300 |
parents | 0ac25efb2da3 |
children | 054f9be0aaf9 |
comparison
equal
deleted
inserted
replaced
8545:4009f120cad4 | 8546:d80365ca678d |
---|---|
89 { | 89 { |
90 ngx_int_t index; | 90 ngx_int_t index; |
91 ngx_http_v3_session_t *h3c; | 91 ngx_http_v3_session_t *h3c; |
92 ngx_http_v3_uni_stream_t *us; | 92 ngx_http_v3_uni_stream_t *us; |
93 | 93 |
94 h3c = ngx_http_v3_get_session(c); | |
95 | |
94 switch (type) { | 96 switch (type) { |
95 | 97 |
96 case NGX_HTTP_V3_STREAM_ENCODER: | 98 case NGX_HTTP_V3_STREAM_ENCODER: |
97 | 99 |
98 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, | 100 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, |
117 | 119 |
118 default: | 120 default: |
119 | 121 |
120 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, | 122 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, |
121 "http3 stream 0x%02xL", type); | 123 "http3 stream 0x%02xL", type); |
124 | |
125 if (h3c->known_streams[NGX_HTTP_V3_STREAM_CLIENT_ENCODER] == NULL | |
126 || h3c->known_streams[NGX_HTTP_V3_STREAM_CLIENT_DECODER] == NULL | |
127 || h3c->known_streams[NGX_HTTP_V3_STREAM_CLIENT_CONTROL] == NULL) | |
128 { | |
129 ngx_log_error(NGX_LOG_INFO, c->log, 0, "missing mandatory stream"); | |
130 return NGX_HTTP_V3_ERR_STREAM_CREATION_ERROR; | |
131 } | |
132 | |
122 index = -1; | 133 index = -1; |
123 } | 134 } |
124 | 135 |
125 if (index >= 0) { | 136 if (index >= 0) { |
126 h3c = ngx_http_v3_get_session(c); | |
127 | |
128 if (h3c->known_streams[index]) { | 137 if (h3c->known_streams[index]) { |
129 ngx_log_error(NGX_LOG_INFO, c->log, 0, "stream exists"); | 138 ngx_log_error(NGX_LOG_INFO, c->log, 0, "stream exists"); |
130 return NGX_HTTP_V3_ERR_STREAM_CREATION_ERROR; | 139 return NGX_HTTP_V3_ERR_STREAM_CREATION_ERROR; |
131 } | 140 } |
132 | 141 |