aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/dav/lib/CardDAV/SystemAddressbook.php2
-rw-r--r--config/config.sample.php5
-rw-r--r--lib/private/Files/Storage/DAV.php14
3 files changed, 18 insertions, 3 deletions
diff --git a/apps/dav/lib/CardDAV/SystemAddressbook.php b/apps/dav/lib/CardDAV/SystemAddressbook.php
index 1cffde63474..1f71c36ef79 100644
--- a/apps/dav/lib/CardDAV/SystemAddressbook.php
+++ b/apps/dav/lib/CardDAV/SystemAddressbook.php
@@ -64,7 +64,7 @@ class SystemAddressbook extends AddressBook {
IUserSession $userSession,
?IRequest $request = null,
?TrustedServers $trustedServers = null,
- ?IGroupManager $groupManager) {
+ ?IGroupManager $groupManager = null) {
parent::__construct($carddavBackend, $addressBookInfo, $l10n);
$this->config = $config;
$this->userSession = $userSession;
diff --git a/config/config.sample.php b/config/config.sample.php
index 94b8a5d0552..c87e1cad9fa 100644
--- a/config/config.sample.php
+++ b/config/config.sample.php
@@ -290,6 +290,11 @@ $CONFIG = [
'session_lifetime' => 60 * 60 * 24,
/**
+ * The timeout in seconds for requests to servers made by the DAV component (e.g., needed for federated shares).
+ */
+'davstorage.request_timeout' => 30,
+
+/**
* `true` enabled a relaxed session timeout, where the session timeout would no longer be
* handled by Nextcloud but by either the PHP garbage collection or the expiration of
* potential other session backends like redis.
diff --git a/lib/private/Files/Storage/DAV.php b/lib/private/Files/Storage/DAV.php
index 733aa10cde6..b5b8b548787 100644
--- a/lib/private/Files/Storage/DAV.php
+++ b/lib/private/Files/Storage/DAV.php
@@ -51,6 +51,7 @@ use OCP\Files\StorageInvalidException;
use OCP\Files\StorageNotAvailableException;
use OCP\Http\Client\IClientService;
use OCP\ICertificateManager;
+use OCP\IConfig;
use OCP\Util;
use Psr\Http\Message\ResponseInterface;
use Sabre\DAV\Client;
@@ -93,6 +94,9 @@ class DAV extends Common {
protected LoggerInterface $logger;
protected IEventLogger $eventLogger;
+ /** @var int */
+ private $timeout;
+
/**
* @param array $params
* @throws \Exception
@@ -135,6 +139,8 @@ class DAV extends Common {
}
$this->logger = \OC::$server->get(LoggerInterface::class);
$this->eventLogger = \OC::$server->get(IEventLogger::class);
+ // This timeout value will be used for the download and upload of files
+ $this->timeout = \OC::$server->get(IConfig::class)->getSystemValueInt('davstorage.request_timeout', 30);
}
protected function init() {
@@ -373,7 +379,9 @@ class DAV extends Common {
->newClient()
->get($this->createBaseUri() . $this->encodePath($path), [
'auth' => [$this->user, $this->password],
- 'stream' => true
+ 'stream' => true,
+ // set download timeout for users with slow connections or large files
+ 'timeout' => $this->timeout
]);
} catch (\GuzzleHttp\Exception\ClientException $e) {
if ($e->getResponse() instanceof ResponseInterface
@@ -530,7 +538,9 @@ class DAV extends Common {
->newClient()
->put($this->createBaseUri() . $this->encodePath($target), [
'body' => $source,
- 'auth' => [$this->user, $this->password]
+ 'auth' => [$this->user, $this->password],
+ // set upload timeout for users with slow connections or large files
+ 'timeout' => $this->timeout
]);
$this->removeCachedFile($target);