mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 16:52:41 +01:00
Make AphrontRequest::getHost() work properly in the presence of a port
Summary: This currently gives us back "domain.com:port" if there's a port, which messes up the new Phame logic. Make `getHost()` do what one would reasonably expect it to. Test Plan: Loaded my local, which is on 8080. Reviewers: btrahan Reviewed By: btrahan CC: aran Differential Revision: https://secure.phabricator.com/D3571
This commit is contained in:
parent
054ea7dc4a
commit
a0070d8bf4
1 changed files with 8 additions and 6 deletions
|
@ -60,7 +60,10 @@ final class AphrontRequest {
|
|||
}
|
||||
|
||||
final public function getHost() {
|
||||
return $this->host;
|
||||
// The "Host" header may include a port number; if so, ignore it. We can't
|
||||
// use PhutilURI since there's no URI scheme.
|
||||
list($actual_host) = explode(':', $this->host, 2);
|
||||
return $actual_host;
|
||||
}
|
||||
|
||||
|
||||
|
@ -272,13 +275,12 @@ final class AphrontRequest {
|
|||
$base_domain = $base_uri->getDomain();
|
||||
$base_protocol = $base_uri->getProtocol();
|
||||
|
||||
// The "Host" header may include a port number; if so, ignore it. We can't
|
||||
// use PhutilURI since there's no URI scheme.
|
||||
list($actual_host) = explode(':', $this->getHost(), 2);
|
||||
if ($base_domain != $actual_host) {
|
||||
$host = $this->getHost();
|
||||
|
||||
if ($base_domain != $host) {
|
||||
throw new Exception(
|
||||
"This install of Phabricator is configured as '{$base_domain}' but ".
|
||||
"you are accessing it via '{$actual_host}'. Access Phabricator via ".
|
||||
"you are accessing it via '{$host}'. Access Phabricator via ".
|
||||
"the primary configured domain.");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue