aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alessandro Ghedini <alessandro@ghedini.me> 2021-01-20 13:52:18 +0000
committerGravatar Alessandro Ghedini <alessandro@ghedini.me> 2021-01-22 15:17:49 +0000
commitd69b59d7243033f7f8af9d9920b129a3f2a91aea (patch)
tree03acdf47bffd0f08a156318735ffdfa85cd91cea
parent5049ea79f79d8fee1622b7e9a03507f82983773b (diff)
downloadquiche-d69b59d7243033f7f8af9d9920b129a3f2a91aea.tar.gz
quiche-d69b59d7243033f7f8af9d9920b129a3f2a91aea.tar.zst
quiche-d69b59d7243033f7f8af9d9920b129a3f2a91aea.zip
nginx: terminate HTTP/3 connection on poll errors
This includes for example failures to parse HTTP/3 frames, which should cause the connection to be shut down with an error. In practice quiche should already be initiating connection close, but due to bugs or other reasons this might not happen, so this change provides an additional layer of robustness.
-rw-r--r--extras/nginx/nginx-1.16.patch17
1 files changed, 11 insertions, 6 deletions
diff --git a/extras/nginx/nginx-1.16.patch b/extras/nginx/nginx-1.16.patch
index 105d8d01..e9a32a64 100644
--- a/extras/nginx/nginx-1.16.patch
+++ b/extras/nginx/nginx-1.16.patch
@@ -1,4 +1,4 @@
-From 1372db755f3ecda39a4baee7978fa150d7053376 Mon Sep 17 00:00:00 2001
+From 289e3c377c45228f2ef223560d752fd401fc6674 Mon Sep 17 00:00:00 2001
From: Alessandro Ghedini <alessandro@cloudflare.com>
Date: Thu, 22 Oct 2020 12:28:02 +0100
Subject: [PATCH] Initial QUIC and HTTP/3 implementation using quiche
@@ -26,12 +26,12 @@ Subject: [PATCH] Initial QUIC and HTTP/3 implementation using quiche
src/http/ngx_http_request.h | 3 +
src/http/ngx_http_request_body.c | 33 +
src/http/ngx_http_upstream.c | 13 +
- src/http/v3/ngx_http_v3.c | 2339 +++++++++++++++++++++++
+ src/http/v3/ngx_http_v3.c | 2344 +++++++++++++++++++++++
src/http/v3/ngx_http_v3.h | 78 +
src/http/v3/ngx_http_v3_filter_module.c | 68 +
src/http/v3/ngx_http_v3_module.c | 286 +++
src/http/v3/ngx_http_v3_module.h | 34 +
- 27 files changed, 3822 insertions(+), 11 deletions(-)
+ 27 files changed, 3827 insertions(+), 11 deletions(-)
create mode 100644 auto/lib/quiche/conf
create mode 100644 auto/lib/quiche/make
create mode 100644 src/event/ngx_event_quic.c
@@ -1572,10 +1572,10 @@ index a7391d09a..398af2797 100644
if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) {
diff --git a/src/http/v3/ngx_http_v3.c b/src/http/v3/ngx_http_v3.c
new file mode 100644
-index 000000000..896e26af6
+index 000000000..6e71f1895
--- /dev/null
+++ b/src/http/v3/ngx_http_v3.c
-@@ -0,0 +1,2339 @@
+@@ -0,0 +1,2344 @@
+
+/*
+ * Copyright (C) Cloudflare, Inc.
@@ -2003,10 +2003,15 @@ index 000000000..896e26af6
+ quiche_h3_event *ev;
+
+ int64_t stream_id = quiche_h3_conn_poll(h3c->h3, c->quic->conn, &ev);
-+ if (stream_id < 0) {
++ if (stream_id == QUICHE_H3_ERR_DONE) {
+ break;
+ }
+
++ if (stream_id < 0) {
++ ngx_http_v3_finalize_connection(h3c, NGX_HTTP_V3_PROTOCOL_ERROR);
++ return;
++ }
++
+ ngx_log_debug2(NGX_LOG_DEBUG_HTTP, h3c->connection->log, 0,
+ "http3 event stream:%ui ev:%ui", stream_id,
+ quiche_h3_event_type(ev));