From e042d64e5ec5b3dad4cc16833131e70912fa7be8 Mon Sep 17 00:00:00 2001 From: uwaa Date: Sun, 27 Oct 2024 23:49:33 +0000 Subject: [PATCH] fix redirect hanging --- MiniHTTP/HttpServer.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MiniHTTP/HttpServer.cs b/MiniHTTP/HttpServer.cs index fbbd9bc..bac8fd0 100644 --- a/MiniHTTP/HttpServer.cs +++ b/MiniHTTP/HttpServer.cs @@ -147,7 +147,8 @@ public sealed class HttpServer throw; } - if (req.Headers.TryGetValue("connection", out string? connectionValue) && connectionValue == "close") + if ((response != null && response.StatusCode is >= 300 and < 400) || + req.Headers.TryGetValue("connection", out string? connectionValue) && connectionValue == "close") { client.Close(); break;