Changeset View
Changeset View
Standalone View
Standalone View
src/aphront/AphrontRequest.php
Show First 20 Lines • Show All 542 Lines • ▼ Show 20 Lines | public function getRequestURI() { | ||||
unset($get['__path__']); | unset($get['__path__']); | ||||
$path = phutil_escape_uri($this->getPath()); | $path = phutil_escape_uri($this->getPath()); | ||||
return id(new PhutilURI($path))->setQueryParams($get); | return id(new PhutilURI($path))->setQueryParams($get); | ||||
} | } | ||||
public function getAbsoluteRequestURI() { | public function getAbsoluteRequestURI() { | ||||
$uri = $this->getRequestURI(); | $uri = $this->getRequestURI(); | ||||
$uri->setDomain($this->getHost()); | $uri->setDomain($this->getHost()); | ||||
$uri->setProtocol($this->isHTTPS() ? 'https' : 'http'); | |||||
if ($this->isHTTPS()) { | |||||
$protocol = 'https'; | |||||
} else { | |||||
$protocol = 'http'; | |||||
} | |||||
$uri->setProtocol($protocol); | |||||
// If the request used a nonstandard port, preserve it while building the | |||||
// absolute URI. | |||||
// First, get the default port for the request protocol. | |||||
$default_port = id(new PhutilURI($protocol.'://example.com/')) | |||||
->getPortWithProtocolDefault(); | |||||
// NOTE: See note in getHost() about malicious "Host" headers. This | |||||
// construction defuses some obscure potential attacks. | |||||
$port = id(new PhutilURI($protocol.'://'.$this->host)) | |||||
->getPort(); | |||||
if (($port !== null) && ($port !== $default_port)) { | |||||
$uri->setPort($port); | |||||
} | |||||
return $uri; | return $uri; | ||||
} | } | ||||
public function isDialogFormPost() { | public function isDialogFormPost() { | ||||
return $this->isFormPost() && $this->getStr('__dialog__'); | return $this->isFormPost() && $this->getStr('__dialog__'); | ||||
} | } | ||||
public function getRemoteAddress() { | public function getRemoteAddress() { | ||||
▲ Show 20 Lines • Show All 270 Lines • Show Last 20 Lines |