Mercurial > hg > nginx-quic
comparison src/http/ngx_http_request.c @ 8636:7f4b2687ac80 quic
HTTP/3: reset streams with incomplete responses or timeouts.
This prevents client from closing the QUIC connection due to response parse
error.
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Mon, 27 Sep 2021 17:08:48 +0300 |
parents | 74b43926b470 |
children | 61d0fa67b55e |
comparison
equal
deleted
inserted
replaced
8635:94daa42ff5ce | 8636:7f4b2687ac80 |
---|---|
3744 log->action = "closing request"; | 3744 log->action = "closing request"; |
3745 | 3745 |
3746 if (r->connection->timedout) { | 3746 if (r->connection->timedout) { |
3747 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); | 3747 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); |
3748 | 3748 |
3749 #if (NGX_HTTP_V3) | |
3750 if (r->connection->quic) { | |
3751 (void) ngx_quic_reset_stream(r->connection, | |
3752 NGX_HTTP_V3_ERR_GENERAL_PROTOCOL_ERROR); | |
3753 } else | |
3754 #endif | |
3749 if (clcf->reset_timedout_connection) { | 3755 if (clcf->reset_timedout_connection) { |
3750 linger.l_onoff = 1; | 3756 linger.l_onoff = 1; |
3751 linger.l_linger = 0; | 3757 linger.l_linger = 0; |
3752 | 3758 |
3753 if (setsockopt(r->connection->fd, SOL_SOCKET, SO_LINGER, | 3759 if (setsockopt(r->connection->fd, SOL_SOCKET, SO_LINGER, |
3755 { | 3761 { |
3756 ngx_log_error(NGX_LOG_ALERT, log, ngx_socket_errno, | 3762 ngx_log_error(NGX_LOG_ALERT, log, ngx_socket_errno, |
3757 "setsockopt(SO_LINGER) failed"); | 3763 "setsockopt(SO_LINGER) failed"); |
3758 } | 3764 } |
3759 } | 3765 } |
3766 | |
3767 } else if (!r->response_sent) { | |
3768 #if (NGX_HTTP_V3) | |
3769 if (r->connection->quic) { | |
3770 (void) ngx_quic_reset_stream(r->connection, | |
3771 NGX_HTTP_V3_ERR_INTERNAL_ERROR); | |
3772 } | |
3773 #endif | |
3760 } | 3774 } |
3761 | 3775 |
3762 /* the various request strings were allocated from r->pool */ | 3776 /* the various request strings were allocated from r->pool */ |
3763 ctx = log->data; | 3777 ctx = log->data; |
3764 ctx->request = NULL; | 3778 ctx->request = NULL; |