route : Allow redirect from same URL to same URL if the method is changed

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1819 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2014-09-16 10:53:29 +00:00
parent 4c0ffd38cd
commit 75910359d9

View File

@@ -129,7 +129,8 @@ class route
// Else http : keep the complete URL
if ($destURL === "")
throw new Exception ("Destination URL is empty", 500);
if ($destURL === $requestURL)
// Allow to redirect from POST to GET, but not GET to GET (can loop)
if ($destURL === $requestURL && $_SERVER["REQUEST_METHOD"] === "GET")
throw new Exception ("Redirect to myself", 508);
if (substr ($destURL, 0, strlen ($baseURL)) !== $baseURL)
throw new Exception ("Can't redirect outside this site (Base $baseURL)",