route: catch the exception generated by route itself

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3733 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2017-05-29 12:32:10 +00:00
parent ee285f0e41
commit 69079baec8

View File

@@ -240,13 +240,14 @@ class route
// Else http : keep the complete URL
if ($destURL === "")
throw new Exception ("Destination URL is empty", 500);
$this->error (new \Exception ("Destination URL is empty", 500));
// 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", 400);
$this->error (new \Exception ("Redirect to myself", 400));
if (substr_count ($baseURL, "../") > 1+ substr_count ($destURL,"/"))
throw new Exception ("Can't redirect outside this site (Base $baseURL)",
405);
$this->error (new \Exception (
"Can't redirect outside this site (Base $baseURL)",
405));
if ($this->debug)
{
@@ -461,7 +462,7 @@ class route
$_SESSION["domframework"]["route"]["lastGet"] =
"/".$this->requestURL ();
}
catch (Exception $e)
catch (\Exception $e)
{
$this->error ($e);
}
@@ -517,7 +518,7 @@ class route
$_SESSION["domframework"]["route"]["lastGet"] =
"/".$this->requestURL ();
}
catch (Exception $e)
catch (\Exception $e)
{
$this->error ($e);
}
@@ -573,7 +574,7 @@ class route
$message .= "<p>The Exception code was 0 and converted to 500</p>\n";
}
}
catch (Exception $e)
catch (\Exception $e)
{
// If there is an error with the ratelimiter (file not writeable...),
// overload the Exception