From d35c8f881e08d9cd02a3842828313e8854228d29 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sun, 29 Dec 2024 16:49:50 +0900 Subject: [PATCH] Explicitly deny new server-initiated bidirectional stream Vanilla HTTP/3 does not allow server to create bidirectional stream. libnghttp3 expects that application configures the QUIC stack like so. Still it would be nice to explicitly deny new server-initiated bidirectional stream for clarity. --- lib/nghttp3_conn.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/nghttp3_conn.c b/lib/nghttp3_conn.c index 1f6c857..0f04e94 100644 --- a/lib/nghttp3_conn.c +++ b/lib/nghttp3_conn.c @@ -434,6 +434,10 @@ nghttp3_ssize nghttp3_conn_read_stream(nghttp3_conn *conn, int64_t stream_id, return rv; } } + } else if(!nghttp3_stream_uni(stream_id)) { + /* server does not expect to receive new server initiated + bidirectional stream from client. */ + return NGHTTP3_ERR_H3_STREAM_CREATION_ERROR; } else { /* unidirectional stream */ if (srclen == 0 && fin) {