Mercurial > hg > nginx
comparison src/http/ngx_http_request.c @ 8903:0d3bf08eaac0 quic
HTTP/3: allowed QUIC stream connection reuse.
A QUIC stream connection is treated as reusable until first bytes of request
arrive, which is also when the request object is now allocated. A connection
closed as a result of draining, is reset with the error code
H3_REQUEST_REJECTED. Such behavior is allowed by quic-http-34:
Once a request stream has been opened, the request MAY be cancelled
by either endpoint. Clients cancel requests if the response is no
longer of interest; servers cancel requests if they are unable to or
choose not to respond.
When the server cancels a request without performing any application
processing, the request is considered "rejected." The server SHOULD
abort its response stream with the error code H3_REQUEST_REJECTED.
The client can treat requests rejected by the server as though they had
never been sent at all, thereby allowing them to be retried later.
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Mon, 18 Oct 2021 15:47:06 +0300 |
parents | 61d0fa67b55e |
children | 33226ac61076 |
comparison
equal
deleted
inserted
replaced
8902:925572184d4a | 8903:0d3bf08eaac0 |
---|---|
3729 ngx_http_log_request(r); | 3729 ngx_http_log_request(r); |
3730 } | 3730 } |
3731 | 3731 |
3732 log->action = "closing request"; | 3732 log->action = "closing request"; |
3733 | 3733 |
3734 if (r->connection->timedout) { | 3734 if (r->connection->timedout |
3735 #if (NGX_HTTP_QUIC) | |
3736 && r->connection->quic == NULL | |
3737 #endif | |
3738 ) | |
3739 { | |
3735 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); | 3740 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); |
3736 | 3741 |
3737 #if (NGX_HTTP_V3) | |
3738 if (r->connection->quic) { | |
3739 (void) ngx_quic_reset_stream(r->connection, | |
3740 NGX_HTTP_V3_ERR_GENERAL_PROTOCOL_ERROR); | |
3741 } else | |
3742 #endif | |
3743 if (clcf->reset_timedout_connection) { | 3742 if (clcf->reset_timedout_connection) { |
3744 linger.l_onoff = 1; | 3743 linger.l_onoff = 1; |
3745 linger.l_linger = 0; | 3744 linger.l_linger = 0; |
3746 | 3745 |
3747 if (setsockopt(r->connection->fd, SOL_SOCKET, SO_LINGER, | 3746 if (setsockopt(r->connection->fd, SOL_SOCKET, SO_LINGER, |
3749 { | 3748 { |
3750 ngx_log_error(NGX_LOG_ALERT, log, ngx_socket_errno, | 3749 ngx_log_error(NGX_LOG_ALERT, log, ngx_socket_errno, |
3751 "setsockopt(SO_LINGER) failed"); | 3750 "setsockopt(SO_LINGER) failed"); |
3752 } | 3751 } |
3753 } | 3752 } |
3754 | |
3755 } else if (!r->response_sent) { | |
3756 #if (NGX_HTTP_V3) | |
3757 if (r->connection->quic) { | |
3758 (void) ngx_quic_reset_stream(r->connection, | |
3759 NGX_HTTP_V3_ERR_INTERNAL_ERROR); | |
3760 } | |
3761 #endif | |
3762 } | 3753 } |
3763 | 3754 |
3764 /* the various request strings were allocated from r->pool */ | 3755 /* the various request strings were allocated from r->pool */ |
3765 ctx = log->data; | 3756 ctx = log->data; |
3766 ctx->request = NULL; | 3757 ctx->request = NULL; |
3814 c->ssl->handler = ngx_http_close_connection; | 3805 c->ssl->handler = ngx_http_close_connection; |
3815 return; | 3806 return; |
3816 } | 3807 } |
3817 } | 3808 } |
3818 | 3809 |
3810 #endif | |
3811 | |
3812 #if (NGX_HTTP_V3) | |
3813 if (ngx_http_v3_connection(c)) { | |
3814 ngx_http_v3_reset_connection(c); | |
3815 } | |
3819 #endif | 3816 #endif |
3820 | 3817 |
3821 #if (NGX_STAT_STUB) | 3818 #if (NGX_STAT_STUB) |
3822 (void) ngx_atomic_fetch_add(ngx_stat_active, -1); | 3819 (void) ngx_atomic_fetch_add(ngx_stat_active, -1); |
3823 #endif | 3820 #endif |