mirror of
https://github.com/KeyZox71/webserv.git
synced 2025-07-16 12:36:32 +02:00
「🏗️」 wip(http/Get): fixed the routeIndex usage
This commit is contained in:
@ -6,7 +6,7 @@
|
|||||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/04/30 09:40:16 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;
|
std::string targ = _target;
|
||||||
|
|
||||||
if (targ[targ.length() - 1] == '/') {
|
|
||||||
targ += _route->getIndex();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_route->isCgi(targ)) {
|
if (_route->isCgi(targ)) {
|
||||||
_log->debug("cgi added");
|
_log->debug("cgi added");
|
||||||
try {
|
try {
|
||||||
@ -162,6 +158,10 @@ Response Get::execute(void) {
|
|||||||
this->_target = this->_route->getRootDir() + this->_target;
|
this->_target = this->_route->getRootDir() + this->_target;
|
||||||
|
|
||||||
try {
|
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 (isDirectory(this->_target)) {
|
||||||
if (!access((this->_target + this->_route->getIndex()).c_str(),
|
if (!access((this->_target + this->_route->getIndex()).c_str(),
|
||||||
R_OK)) {
|
R_OK)) {
|
||||||
|
Reference in New Issue
Block a user