mirror of
https://github.com/nextcloud/server.git
synced 2024-08-25 17:54:59 +02:00
Merge pull request #18149 from nextcloud/fix/18148/dont-create-bundle-too-early
delay creation of the cert bundle
This commit is contained in:
commit
6a940d5c74
@ -34,7 +34,6 @@
|
|||||||
namespace OC\Files\Storage;
|
namespace OC\Files\Storage;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use GuzzleHttp\Exception\RequestException;
|
|
||||||
use Icewind\Streams\CallbackWrapper;
|
use Icewind\Streams\CallbackWrapper;
|
||||||
use Icewind\Streams\IteratorDirectory;
|
use Icewind\Streams\IteratorDirectory;
|
||||||
use OC\Files\Filesystem;
|
use OC\Files\Filesystem;
|
||||||
@ -45,6 +44,8 @@ use OCP\Files\FileInfo;
|
|||||||
use OCP\Files\ForbiddenException;
|
use OCP\Files\ForbiddenException;
|
||||||
use OCP\Files\StorageInvalidException;
|
use OCP\Files\StorageInvalidException;
|
||||||
use OCP\Files\StorageNotAvailableException;
|
use OCP\Files\StorageNotAvailableException;
|
||||||
|
use OCP\Http\Client\IClientService;
|
||||||
|
use OCP\ICertificateManager;
|
||||||
use OCP\ILogger;
|
use OCP\ILogger;
|
||||||
use OCP\Util;
|
use OCP\Util;
|
||||||
use Psr\Http\Message\ResponseInterface;
|
use Psr\Http\Message\ResponseInterface;
|
||||||
@ -79,8 +80,10 @@ class DAV extends Common {
|
|||||||
protected $client;
|
protected $client;
|
||||||
/** @var ArrayCache */
|
/** @var ArrayCache */
|
||||||
protected $statCache;
|
protected $statCache;
|
||||||
/** @var \OCP\Http\Client\IClientService */
|
/** @var IClientService */
|
||||||
protected $httpClientService;
|
protected $httpClientService;
|
||||||
|
/** @var ICertificateManager */
|
||||||
|
protected $certManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $params
|
* @param array $params
|
||||||
@ -111,13 +114,9 @@ class DAV extends Common {
|
|||||||
}
|
}
|
||||||
if ($this->secure === true) {
|
if ($this->secure === true) {
|
||||||
// inject mock for testing
|
// inject mock for testing
|
||||||
$certManager = \OC::$server->getCertificateManager();
|
$this->certManager = \OC::$server->getCertificateManager();
|
||||||
if (is_null($certManager)) { //no user
|
if (is_null($this->certManager)) { //no user
|
||||||
$certManager = \OC::$server->getCertificateManager(null);
|
$this->certManager = \OC::$server->getCertificateManager(null);
|
||||||
}
|
|
||||||
$certPath = $certManager->getAbsoluteBundlePath();
|
|
||||||
if (file_exists($certPath)) {
|
|
||||||
$this->certPath = $certPath;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->root = $params['root'] ?? '/';
|
$this->root = $params['root'] ?? '/';
|
||||||
@ -150,8 +149,15 @@ class DAV extends Common {
|
|||||||
|
|
||||||
$this->client = new Client($settings);
|
$this->client = new Client($settings);
|
||||||
$this->client->setThrowExceptions(true);
|
$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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user