diff options
Diffstat (limited to 'apps/files_external')
-rw-r--r-- | apps/files_external/lib/webdav.php | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/apps/files_external/lib/webdav.php b/apps/files_external/lib/webdav.php index 2308c7873b8..9d56be8472a 100644 --- a/apps/files_external/lib/webdav.php +++ b/apps/files_external/lib/webdav.php @@ -65,15 +65,15 @@ class DAV extends \OC\Files\Storage\Common{ } $this->ready = true; - $settings = array( - 'baseUri' => $this->createBaseUri(), - 'userName' => $this->user, - 'password' => $this->password, - ); + $settings = array( + 'baseUri' => $this->createBaseUri(), + 'userName' => $this->user, + 'password' => $this->password, + ); $this->client = new \Sabre_DAV_Client($settings); - if ($this->certPath) { + if ($this->secure === true && $this->certPath) { $this->client->addTrustedCertificates($this->certPath); } } @@ -169,12 +169,14 @@ class DAV extends \OC\Files\Storage\Common{ curl_setopt($curl, CURLOPT_URL, $this->createBaseUri().str_replace(' ', '%20', $path)); curl_setopt($curl, CURLOPT_FILE, $fp); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); - curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true); - curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2); - if($this->certPath){ - curl_setopt($curl, CURLOPT_CAINFO, $this->certPath); - } - + if ($this->secure === true) { + curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true); + curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2); + if($this->certPath){ + curl_setopt($curl, CURLOPT_CAINFO, $this->certPath); + } + } + curl_exec ($curl); curl_close ($curl); rewind($fp); @@ -262,11 +264,13 @@ class DAV extends \OC\Files\Storage\Common{ curl_setopt($curl, CURLOPT_INFILE, $source); // file pointer curl_setopt($curl, CURLOPT_INFILESIZE, filesize($path)); curl_setopt($curl, CURLOPT_PUT, true); - curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true); - curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2); - if($this->certPath){ - curl_setopt($curl, CURLOPT_CAINFO, $this->certPath); - } + if ($this->secure === true) { + curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true); + curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2); + if($this->certPath){ + curl_setopt($curl, CURLOPT_CAINFO, $this->certPath); + } + } curl_exec ($curl); curl_close ($curl); } |