diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2019-11-29 09:07:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-29 09:07:33 +0100 |
commit | 6a940d5c742490e4e891f675e3f45b5f975cf650 (patch) | |
tree | 0461d0789f7976953f552072a127265ffbb390a4 /lib/private/Files | |
parent | 09c1d8c316aa4e066668b048a7abdbbde57caac2 (diff) | |
parent | 0e911d643f432e81c378b03c7862faec58283783 (diff) | |
download | nextcloud-server-6a940d5c742490e4e891f675e3f45b5f975cf650.tar.gz nextcloud-server-6a940d5c742490e4e891f675e3f45b5f975cf650.zip |
Merge pull request #18149 from nextcloud/fix/18148/dont-create-bundle-too-early
delay creation of the cert bundle
Diffstat (limited to 'lib/private/Files')
-rw-r--r-- | lib/private/Files/Storage/DAV.php | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/lib/private/Files/Storage/DAV.php b/lib/private/Files/Storage/DAV.php index 69e6f309c31..ca96e6b7434 100644 --- a/lib/private/Files/Storage/DAV.php +++ b/lib/private/Files/Storage/DAV.php @@ -34,7 +34,6 @@ namespace OC\Files\Storage; use Exception; -use GuzzleHttp\Exception\RequestException; use Icewind\Streams\CallbackWrapper; use Icewind\Streams\IteratorDirectory; use OC\Files\Filesystem; @@ -45,6 +44,8 @@ use OCP\Files\FileInfo; use OCP\Files\ForbiddenException; use OCP\Files\StorageInvalidException; use OCP\Files\StorageNotAvailableException; +use OCP\Http\Client\IClientService; +use OCP\ICertificateManager; use OCP\ILogger; use OCP\Util; use Psr\Http\Message\ResponseInterface; @@ -79,8 +80,10 @@ class DAV extends Common { protected $client; /** @var ArrayCache */ protected $statCache; - /** @var \OCP\Http\Client\IClientService */ + /** @var IClientService */ protected $httpClientService; + /** @var ICertificateManager */ + protected $certManager; /** * @param array $params @@ -111,13 +114,9 @@ class DAV extends Common { } if ($this->secure === true) { // inject mock for testing - $certManager = \OC::$server->getCertificateManager(); - if (is_null($certManager)) { //no user - $certManager = \OC::$server->getCertificateManager(null); - } - $certPath = $certManager->getAbsoluteBundlePath(); - if (file_exists($certPath)) { - $this->certPath = $certPath; + $this->certManager = \OC::$server->getCertificateManager(); + if (is_null($this->certManager)) { //no user + $this->certManager = \OC::$server->getCertificateManager(null); } } $this->root = $params['root'] ?? '/'; @@ -150,8 +149,15 @@ class DAV extends Common { $this->client = new Client($settings); $this->client->setThrowExceptions(true); - if ($this->secure === true && $this->certPath) { - $this->client->addCurlSetting(CURLOPT_CAINFO, $this->certPath); + + if($this->secure === true) { + $certPath = $this->certManager->getAbsoluteBundlePath(); + if (file_exists($certPath)) { + $this->certPath = $certPath; + } + if ($this->certPath) { + $this->client->addCurlSetting(CURLOPT_CAINFO, $this->certPath); + } } } |