Mercurial > hg > nginx
comparison src/http/modules/ngx_http_quic_module.c @ 8825:59d2d47ad3c6 quic
QUIC: stream limits in "hq" mode.
The "hq" mode is HTTP/0.9-1.1 over QUIC. The following limits are introduced:
- uni streams are not allowed
- keepalive_requests is enforced
- keepalive_time is enforced
In case of error, QUIC connection is finalized with 0x101 code. This code
corresponds to HTTP/3 General Protocol Error.
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Mon, 02 Aug 2021 15:48:21 +0300 |
parents | 8ab0d609af09 |
children | 74b43926b470 |
comparison
equal
deleted
inserted
replaced
8824:054f9be0aaf9 | 8825:59d2d47ad3c6 |
---|---|
186 | 186 |
187 | 187 |
188 ngx_int_t | 188 ngx_int_t |
189 ngx_http_quic_init(ngx_connection_t *c) | 189 ngx_http_quic_init(ngx_connection_t *c) |
190 { | 190 { |
191 uint64_t n; | |
191 ngx_quic_conf_t *qcf; | 192 ngx_quic_conf_t *qcf; |
192 ngx_http_connection_t *hc, *phc; | 193 ngx_http_connection_t *hc, *phc; |
193 ngx_http_core_loc_conf_t *clcf; | 194 ngx_http_core_loc_conf_t *clcf; |
194 | 195 |
195 hc = c->data; | 196 hc = c->data; |
205 | 206 |
206 return NGX_DONE; | 207 return NGX_DONE; |
207 } | 208 } |
208 | 209 |
209 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http init quic stream"); | 210 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http init quic stream"); |
211 | |
212 #if (NGX_HTTP_V3) | |
213 if (!hc->addr_conf->http3) | |
214 #endif | |
215 { | |
216 /* Use HTTP/3 General Protocol Error Code 0x101 for finalization */ | |
217 | |
218 if (c->quic->id & NGX_QUIC_STREAM_UNIDIRECTIONAL) { | |
219 ngx_quic_finalize_connection(c->quic->parent, 0x101, | |
220 "unexpected uni stream"); | |
221 ngx_http_close_connection(c); | |
222 return NGX_DONE; | |
223 } | |
224 | |
225 clcf = ngx_http_get_module_loc_conf(hc->conf_ctx, ngx_http_core_module); | |
226 | |
227 n = c->quic->id >> 2; | |
228 | |
229 if (n >= clcf->keepalive_requests) { | |
230 ngx_quic_finalize_connection(c->quic->parent, 0x101, | |
231 "reached maximum number of requests"); | |
232 ngx_http_close_connection(c); | |
233 return NGX_DONE; | |
234 } | |
235 | |
236 if (ngx_current_msec - c->quic->parent->start_time | |
237 > clcf->keepalive_time) | |
238 { | |
239 ngx_quic_finalize_connection(c->quic->parent, 0x101, | |
240 "reached maximum time for requests"); | |
241 ngx_http_close_connection(c); | |
242 return NGX_DONE; | |
243 } | |
244 } | |
210 | 245 |
211 phc = ngx_http_quic_get_connection(c); | 246 phc = ngx_http_quic_get_connection(c); |
212 | 247 |
213 if (phc->ssl_servername) { | 248 if (phc->ssl_servername) { |
214 hc->ssl_servername = phc->ssl_servername; | 249 hc->ssl_servername = phc->ssl_servername; |