diff options
author | Roman Arutyunyan <arut@nginx.com> | 2020-07-02 16:47:51 +0300 |
---|---|---|
committer | Roman Arutyunyan <arut@nginx.com> | 2020-07-02 16:47:51 +0300 |
commit | 707117276ed252e39c75769a140cbac6e18eb74a (patch) | |
tree | 4c8e1aefc4b7f23785d8a56d84421a38236eb28c /src/http/ngx_http_request.c | |
parent | fd35d92232ca2332125fe9b29e53aaec33aa2176 (diff) | |
download | nginx-707117276ed252e39c75769a140cbac6e18eb74a.tar.gz nginx-707117276ed252e39c75769a140cbac6e18eb74a.zip |
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Previously errors led only to closing streams.
To simplify closing QUIC connection from a QUIC stream context, new macro
ngx_http_v3_finalize_connection() is introduced. It calls
ngx_quic_finalize_connection() for the parent connection.
Diffstat (limited to 'src/http/ngx_http_request.c')
-rw-r--r-- | src/http/ngx_http_request.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c index 89e554bf2..c953386d4 100644 --- a/src/http/ngx_http_request.c +++ b/src/http/ngx_http_request.c @@ -416,19 +416,21 @@ static void ngx_http_quic_stream_handler(ngx_connection_t *c) { ngx_event_t *rev; - ngx_connection_t *pc; ngx_http_log_ctx_t *ctx; ngx_http_connection_t *hc; ngx_http_v3_connection_t *h3c; - pc = c->qs->parent; - h3c = pc->data; + h3c = c->qs->parent->data; if (!h3c->settings_sent) { h3c->settings_sent = 1; - /* TODO close QUIC connection on error */ - (void) ngx_http_v3_send_settings(c); + if (ngx_http_v3_send_settings(c) != NGX_OK) { + ngx_http_v3_finalize_connection(c, NGX_HTTP_V3_ERR_INTERNAL_ERROR, + "could not send settings"); + ngx_http_close_connection(c); + return; + } } if (c->qs->id & NGX_QUIC_STREAM_UNIDIRECTIONAL) { |