aboutsummaryrefslogtreecommitdiff
path: root/src/http/ngx_http_request.c
diff options
context:
space:
mode:
authorRoman Arutyunyan <arut@nginx.com>2021-09-27 17:08:48 +0300
committerRoman Arutyunyan <arut@nginx.com>2021-09-27 17:08:48 +0300
commit38d56f4ccd94ffba49e84ace82125249af7ef20a (patch)
treef7761424bc455816a1d0023cc067642555392858 /src/http/ngx_http_request.c
parentb6b2a45fb6824185889373cc0af070c4a90c1b4a (diff)
downloadnginx-38d56f4ccd94ffba49e84ace82125249af7ef20a.tar.gz
nginx-38d56f4ccd94ffba49e84ace82125249af7ef20a.zip
HTTP/3: reset streams with incomplete responses or timeouts.
This prevents client from closing the QUIC connection due to response parse error.
Diffstat (limited to 'src/http/ngx_http_request.c')
-rw-r--r--src/http/ngx_http_request.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c
index 6496a5400..e37ef8024 100644
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -3746,6 +3746,12 @@ ngx_http_free_request(ngx_http_request_t *r, ngx_int_t rc)
if (r->connection->timedout) {
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
+#if (NGX_HTTP_V3)
+ if (r->connection->quic) {
+ (void) ngx_quic_reset_stream(r->connection,
+ NGX_HTTP_V3_ERR_GENERAL_PROTOCOL_ERROR);
+ } else
+#endif
if (clcf->reset_timedout_connection) {
linger.l_onoff = 1;
linger.l_linger = 0;
@@ -3757,6 +3763,14 @@ ngx_http_free_request(ngx_http_request_t *r, ngx_int_t rc)
"setsockopt(SO_LINGER) failed");
}
}
+
+ } else if (!r->response_sent) {
+#if (NGX_HTTP_V3)
+ if (r->connection->quic) {
+ (void) ngx_quic_reset_stream(r->connection,
+ NGX_HTTP_V3_ERR_INTERNAL_ERROR);
+ }
+#endif
}
/* the various request strings were allocated from r->pool */