1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-09 16:32:39 +01:00

Raise early fatal for bad rewrite with no "/"

Summary: This particular misconfiguration results in a difficult-to-debug redirect loop, so stop it early.

Test Plan: Broke my rewrite rule, verified I got yelled at.

Reviewers: btrahan, chad

Reviewed By: chad

CC: aran

Differential Revision: https://secure.phabricator.com/D4591
This commit is contained in:
epriestley 2013-01-22 17:17:37 -08:00
parent 72ec4f7a6f
commit 3c3e00a74f

View file

@ -221,7 +221,7 @@ final class PhabricatorStartup {
* @task valiation
*/
private static function verifyRewriteRules() {
if (isset($_REQUEST['__path__'])) {
if (isset($_REQUEST['__path__']) && strlen($_REQUEST['__path__'])) {
return;
}
@ -229,11 +229,21 @@ final class PhabricatorStartup {
// Compatibility with PHP 5.4+ built-in web server.
$url = parse_url($_SERVER['REQUEST_URI']);
$_REQUEST['__path__'] = $url['path'];
} else {
return;
}
if (!isset($_REQUEST['__path__'])) {
self::didFatal(
"Request parameter '__path__' is not set. Your rewrite rules ".
"are not configured correctly.");
}
if (!strlen($_REQUEST['__path__'])) {
self::didFatal(
"Request parameter '__path__' is set, but empty. Your rewrite rules ".
"are not configured correctly. The '__path__' should always ".
"begin with a '/'.");
}
}