From 8e5f80b9947b6ac1a8da6493c7c832dce1c463c3 Mon Sep 17 00:00:00 2001 From: y-syo Date: Mon, 30 Jun 2025 15:05:20 +0200 Subject: [PATCH] =?UTF-8?q?=E3=80=8C=F0=9F=8F=97=EF=B8=8F=E3=80=8D=20wip(h?= =?UTF-8?q?ttp/Get):=20fixed=20the=20routeIndex=20usage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/requests_handling/requestImplementation/Get.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/requests_handling/requestImplementation/Get.cpp b/src/requests_handling/requestImplementation/Get.cpp index 266fda3..3fb0fee 100644 --- a/src/requests_handling/requestImplementation/Get.cpp +++ b/src/requests_handling/requestImplementation/Get.cpp @@ -6,7 +6,7 @@ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/04/30 09:40:16 by adjoly #+# #+# */ -/* Updated: 2025/06/24 18:02:19 by adjoly ### ########.fr */ +/* Updated: 2025/06/30 15:03:52 by mmoussou ### ########.fr */ /* */ /* ************************************************************************** */ @@ -71,10 +71,6 @@ void Get::parse(std::string const &data) { std::string targ = _target; - if (targ[targ.length() - 1] == '/') { - targ += _route->getIndex(); - } - if (_route->isCgi(targ)) { _log->debug("cgi added"); try { @@ -162,6 +158,10 @@ Response Get::execute(void) { this->_target = this->_route->getRootDir() + this->_target; try { + if (!access((this->_target + (this->_target[this->_target.length() - 1] != '/' ? std::string("/") : "") + _route->getIndex()).c_str(), R_OK)) + { + this->_target += (this->_target[this->_target.length() - 1] != '/' ? std::string("/") : "") + _route->getIndex(); + } if (isDirectory(this->_target)) { if (!access((this->_target + this->_route->getIndex()).c_str(), R_OK)) {