diff options
author | Lukas Reschke <lukas@owncloud.com> | 2014-12-03 19:54:48 +0100 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2014-12-03 19:59:50 +0100 |
commit | 69f5f6649e05dd404aa67fab95c5bb34e9ce4d1f (patch) | |
tree | e32a952022705582e372ed4fb246172e120404f2 /tests | |
parent | 8700ffe69809d7551a08f224537650b43add2a59 (diff) | |
download | nextcloud-server-69f5f6649e05dd404aa67fab95c5bb34e9ce4d1f.tar.gz nextcloud-server-69f5f6649e05dd404aa67fab95c5bb34e9ce4d1f.zip |
Trim port from domain
Depending on the used environment the port might be appended to the host header resulting in an inaccessible instance when initially setting up on a system with a different HTTP or HTTPS port. (for example test:500)
To test this setup ownCloud under a different port with and without this patch. (heads-up: localhost is always white-listed, so use a different domain)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/request.php | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/lib/request.php b/tests/lib/request.php index 254048723e7..3b70ed0ba25 100644 --- a/tests/lib/request.php +++ b/tests/lib/request.php @@ -228,6 +228,22 @@ class Test_Request extends \Test\TestCase { OC_Config::deleteKey('overwritehost'); } + public function hostWithPortProvider() { + return array( + array('localhost:500', 'localhost'), + array('foo.com', 'foo.com'), + array('[1fff:0:a88:85a3::ac1f]:801', '[1fff:0:a88:85a3::ac1f]') + ); + } + + /** + * @dataProvider hostWithPortProvider + */ + public function testGetDomainWithoutPort($hostWithPort, $host) { + $this->assertEquals($host, OC_Request::getDomainWithoutPort($hostWithPort)); + + } + /** * @dataProvider trustedDomainDataProvider */ |