From 6263fe3dd50f13ed56f7e75ec7dee8ac5f4020a3 Mon Sep 17 00:00:00 2001 From: Quinten Date: Tue, 11 Nov 2025 17:33:24 +0100 Subject: [PATCH] fix: update parseFullpath to set baseName on invalid path segment and add debug log for CGI check --- webserv/handler/URI.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/webserv/handler/URI.cpp b/webserv/handler/URI.cpp index dac0043..3465f71 100644 --- a/webserv/handler/URI.cpp +++ b/webserv/handler/URI.cpp @@ -106,7 +106,6 @@ void URI::parseUri() void URI::parseFullpath() { auto uriSegments = utils::split(fullPath_, '/'); - for (const auto &segment : uriSegments) { std::string currentPath = FileUtils::joinPath(dir_, segment); @@ -135,6 +134,7 @@ void URI::parseFullpath() else // not file or dir, and no baseName yet { valid_ = false; + baseName_ = segment; // TODO: is this correct? works for tester but seems odd Log::warning("Invalid path segment encountered: " + currentPath); return; } @@ -177,6 +177,7 @@ bool URI::isValid() const noexcept bool URI::isCgi() const noexcept { + Log::debug("Check for CGI extension: " + getExtension() + ", with basename " + baseName_); return config_->isCGI(getExtension()); }