mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-21 22:32:41 +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:
parent
72ec4f7a6f
commit
3c3e00a74f
1 changed files with 12 additions and 2 deletions
|
@ -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 '/'.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue