mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-27 07:44:04 +02:00
Url: Always compare host and port to identify external urls
(cherry picked from commit 2b08d88edff8381f513ad7138b2204953e1c406c)
This commit is contained in:
parent
4a479e48db
commit
8e5b32aef3
@ -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