mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-01 00:02:21 +09:00
Add unit tests for Security and URL classes
This commit is contained in:
parent
6d13142f30
commit
b693c8cdad
3 changed files with 134 additions and 2 deletions
|
|
@ -44,7 +44,7 @@ class URL
|
|||
*/
|
||||
public static function getCanonicalURL($url)
|
||||
{
|
||||
if (preg_match('#^\.?/([^/]|$)#', $url))
|
||||
if (preg_match('#^\.?/([^/]|$)#', $url) || !preg_match('#^(https?:|/)#', $url))
|
||||
{
|
||||
$proto = \RX_SSL ? 'https://' : 'http://';
|
||||
$host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'localhost';
|
||||
|
|
@ -89,7 +89,7 @@ class URL
|
|||
return true;
|
||||
}
|
||||
|
||||
if ($domain === self::getDomainFromURL($_SERVER['HTTP_HOST']))
|
||||
if ($domain === self::getDomainFromURL('http://' . $_SERVER['HTTP_HOST']))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue