summaryrefslogtreecommitdiffhomepage
path: root/src/http/v3/ngx_http_v3_streams.c
diff options
context:
space:
mode:
authorRoman Arutyunyan <arut@nginx.com>2021-03-15 19:26:04 +0300
committerRoman Arutyunyan <arut@nginx.com>2021-03-15 19:26:04 +0300
commit190b5d961c0c9b0942dd1a2d8cd609416d0d5114 (patch)
treef37f150fa478b6946e7f089f258c6c1b898101c6 /src/http/v3/ngx_http_v3_streams.c
parentd8fd0b31619ed7302690abf1b27a7c7ec99fbc9d (diff)
downloadnginx-190b5d961c0c9b0942dd1a2d8cd609416d0d5114.tar.gz
nginx-190b5d961c0c9b0942dd1a2d8cd609416d0d5114.tar.bz2
HTTP/3: send GOAWAY when last request is accepted.
The last request in connection is determined according to the keepalive_requests directive. Requests beyond keepalive_requests are rejected.
Diffstat (limited to '')
-rw-r--r--src/http/v3/ngx_http_v3_streams.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/http/v3/ngx_http_v3_streams.c b/src/http/v3/ngx_http_v3_streams.c
index c27fa16dc..e09556c93 100644
--- a/src/http/v3/ngx_http_v3_streams.c
+++ b/src/http/v3/ngx_http_v3_streams.c
@@ -523,6 +523,40 @@ failed:
ngx_int_t
+ngx_http_v3_send_goaway(ngx_connection_t *c, uint64_t id)
+{
+ u_char *p, buf[NGX_HTTP_V3_VARLEN_INT_LEN * 3];
+ size_t n;
+ ngx_connection_t *cc;
+
+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 send goaway %uL", id);
+
+ cc = ngx_http_v3_get_uni_stream(c, NGX_HTTP_V3_STREAM_CONTROL);
+ if (cc == NULL) {
+ return NGX_DECLINED;
+ }
+
+ n = ngx_http_v3_encode_varlen_int(NULL, id);
+ p = (u_char *) ngx_http_v3_encode_varlen_int(buf, NGX_HTTP_V3_FRAME_GOAWAY);
+ p = (u_char *) ngx_http_v3_encode_varlen_int(p, n);
+ p = (u_char *) ngx_http_v3_encode_varlen_int(p, id);
+ n = p - buf;
+
+ if (cc->send(cc, buf, n) != (ssize_t) n) {
+ goto failed;
+ }
+
+ return NGX_OK;
+
+failed:
+
+ ngx_http_v3_close_uni_stream(cc);
+
+ return NGX_ERROR;
+}
+
+
+ngx_int_t
ngx_http_v3_client_ref_insert(ngx_connection_t *c, ngx_uint_t dynamic,
ngx_uint_t index, ngx_str_t *value)
{