mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-04-08 17:15:08 +02:00
Url: Always compare host and port to identify external urls
This commit is contained in:
parent
191444ccd9
commit
2b08d88edf
@ -179,10 +179,9 @@ class Url
|
||||
}
|
||||
|
||||
$urlParts = parse_url($url);
|
||||
if (isset($urlParts['scheme']) && (
|
||||
$urlParts['scheme'] !== $request->getScheme()
|
||||
if ((isset($urlParts['scheme']) && $urlParts['scheme'] !== $request->getScheme())
|
||||
|| (isset($urlParts['host']) && $urlParts['host'] !== $request->getServer('SERVER_NAME'))
|
||||
|| (isset($urlParts['port']) && $urlParts['port'] != $request->getServer('SERVER_PORT')))
|
||||
|| (isset($urlParts['port']) && $urlParts['port'] != $request->getServer('SERVER_PORT'))
|
||||
) {
|
||||
$urlObject->setIsExternal();
|
||||
}
|
||||
|
@ -71,6 +71,11 @@ class UrlTest extends BaseTestCase
|
||||
);
|
||||
}
|
||||
|
||||
public function testWhetherProtocolRelativeUrlsAreDetectedAsBeingExternal()
|
||||
{
|
||||
$this->assertTrue(Url::fromPath('//testhost/path/to/my/url.html')->isExternal());
|
||||
}
|
||||
|
||||
public function testWhetherGetAbsoluteUrlReturnsTheGivenUsernameAndPassword()
|
||||
{
|
||||
$url = Url::fromPath('http://testusername:testpassword@testsite.com/path/to/my/url.html');
|
||||
|
Loading…
x
Reference in New Issue
Block a user