🏗️」 wip(http/Get): fixed the routeIndex usage

This commit is contained in:
y-syo
2025-06-30 15:05:20 +02:00
parent 560c87f152
commit 8e5f80b994

View File

@ -6,7 +6,7 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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)) {