From 972ecf8c1372d8b22d0ead0facdf33db80864185 Mon Sep 17 00:00:00 2001 From: Johann150 Date: Sat, 16 Jan 2021 13:08:21 +0100 Subject: [PATCH] correctly redirect directories cf. --- src/main.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index b1549dc..d60b2d2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -204,7 +204,9 @@ async fn send_response(url: Url, stream: &mut TlsStream) -> Result { } } else { // if client is not redirected, links may not work as expected without trailing slash - return send_header(stream, 31, &[url.as_str(), "/"]).await; + let mut url = url; + url.set_path(&format!("{}/", url.path())); + return send_header(stream, 31, &[url.as_str()]).await; } } }