diff --git a/srcs/webserv/response.cpp b/srcs/webserv/response.cpp index 172a942..0699bce 100644 --- a/srcs/webserv/response.cpp +++ b/srcs/webserv/response.cpp @@ -239,23 +239,40 @@ if no path coresponds then use the most correct one // if (it->path[it->path.size() - 1] == '/' // && it->path.compare(0, it->path.size(), path + "/") == 0) // HOLD ON THIS MIGHT BE GOOD, BUT I COULD USE SOME HELP... + +//test /test/ + +//test/redirect/index /test/redirect +//test/redirec_something + +// thing is reverse sorted +// if location path is longer than path sent, don't look at it +// otherwise compare if (path.compare(0, it->path.size(), it->path) == 0) +// do another size compare and look for / if location smaller than client otherwise /redirect_something /redirect + +// compare everything +// + if (it->path[it->path.size() - 1] == '/' && it->path.compare(0, it->path.size() - 1, path) == 0) { best = it; std::cout << "Picked a best! 1\n"; } -// int comp = path.compare(0, rit->path.size(), rit->path); + int comp = path.compare(0, rit->path.size(), rit->path); //int comp = rit->path.compare(0, rit->path.size() - 1, path); -// std::cout << "rit path size: " << rit->path.size() << " comp: " << comp << '\n'; + std::cout << "rit path size: " << rit->path.size() << " comp: " << comp << '\n'; // if (rit->path.compare(0, rit->path.size(), path) == 0) - // if (comp == 0) + if (comp == 0) + if (path.compare(0, it->path.size(), it->path) == 0) { best = it; std::cout << "Picked a best! 2\n"; } } +// //test.comare(0, 5, /test/something) + // /test /test/something return (&(*best)); }