* FIXME: Should not be in here at all :see_no_evil:
*/
if (!OC::$CLI
- // overwritehost is always trusted, workaround to not have to make
- // \OC\AppFramework\Http\Request::getOverwriteHost public
- && self::$server->getConfig()->getSystemValue('overwritehost') === ''
&& !\OC::$server->getTrustedDomainHelper()->isTrustedDomain($host)
&& self::$server->getConfig()->getSystemValue('installed', false)
) {
* have been configured
*/
public function isTrustedDomain($domainWithPort) {
+ // overwritehost is always trusted
+ if ($this->config->getSystemValue('overwritehost') !== '') {
+ return true;
+ }
+
$domain = $this->getDomainWithoutPort($domainWithPort);
// Read trusted domains from config
* @param bool $result
*/
public function testIsTrustedDomain($trustedDomains, $testDomain, $result) {
- $this->config->expects($this->once())
+ $this->config->expects($this->at(0))
+ ->method('getSystemValue')
+ ->with('overwritehost')
+ ->will($this->returnValue(''));
+ $this->config->expects($this->at(1))
->method('getSystemValue')
->with('trusted_domains')
->will($this->returnValue($trustedDomains));
[$trustedHostTestList, 'bad..der.leading.host', false],
];
}
+
+ public function testIsTrustedDomainOverwriteHost() {
+ $this->config->expects($this->at(0))
+ ->method('getSystemValue')
+ ->with('overwritehost')
+ ->will($this->returnValue('myproxyhost'));
+
+ $trustedDomainHelper = new TrustedDomainHelper($this->config);
+ $this->assertTrue($trustedDomainHelper->isTrustedDomain('myproxyhost'));
+ $this->assertTrue($trustedDomainHelper->isTrustedDomain('myotherhost'));
+ }
}