diff options
author | Robin Appelman <robin@icewind.nl> | 2017-10-19 15:36:39 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2017-12-08 16:37:14 +0100 |
commit | f1eb55fad77c25e63c90e4c132b16262c56d9cdf (patch) | |
tree | 23cdb6237e93440284aa23fcbbf1f080ad5e5a60 /lib/private/Remote | |
parent | 78a24e3b8148a03a12bf5c93b5a19cb252ea6323 (diff) | |
download | nextcloud-server-f1eb55fad77c25e63c90e4c132b16262c56d9cdf.tar.gz nextcloud-server-f1eb55fad77c25e63c90e4c132b16262c56d9cdf.zip |
refuse to use http if we know a remote has https
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private/Remote')
-rw-r--r-- | lib/private/Remote/Instance.php | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/private/Remote/Instance.php b/lib/private/Remote/Instance.php index 0ed301ae868..3e77226edad 100644 --- a/lib/private/Remote/Instance.php +++ b/lib/private/Remote/Instance.php @@ -97,19 +97,26 @@ class Instance implements IInstance { /** * @return array * @throws NotFoundException + * @throws \Exception */ private function getStatus() { if ($this->status) { return $this->status; } $key = 'remote/' . $this->url . '/status'; + $httpsKey = 'remote/' . $this->url . '/https'; $status = $this->cache->get($key); if (!$status) { $response = $this->downloadStatus('https://' . $this->getUrl() . '/status.php'); $protocol = 'https'; if (!$response) { + if ($status = $this->cache->get($httpsKey)) { + throw new \Exception('refusing to connect to remote instance(' . $this->url . ') over http that was previously accessible over https'); + } $response = $this->downloadStatus('http://' . $this->getUrl() . '/status.php'); $protocol = 'http'; + } else { + $this->cache->set($httpsKey, true, 60 * 60 * 24 * 365); } $status = json_decode($response, true); if ($status) { |