Eric notes to self

This commit is contained in:
Me
2022-08-09 20:06:28 +02:00
parent 482a38952e
commit 56f4cf7e15

View File

@@ -239,23 +239,40 @@ if no path coresponds then use the most correct one
// if (it->path[it->path.size() - 1] == '/' // if (it->path[it->path.size() - 1] == '/'
// && it->path.compare(0, it->path.size(), path + "/") == 0) // && it->path.compare(0, it->path.size(), path + "/") == 0)
// HOLD ON THIS MIGHT BE GOOD, BUT I COULD USE SOME HELP... // 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] == '/' if (it->path[it->path.size() - 1] == '/'
&& it->path.compare(0, it->path.size() - 1, path) == 0) && it->path.compare(0, it->path.size() - 1, path) == 0)
{ {
best = it; best = it;
std::cout << "Picked a best! 1\n"; 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); //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 (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) if (path.compare(0, it->path.size(), it->path) == 0)
{ {
best = it; best = it;
std::cout << "Picked a best! 2\n"; std::cout << "Picked a best! 2\n";
} }
} }
// //test.comare(0, 5, /test/something)
// /test /test/something
return (&(*best)); return (&(*best));
} }