Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Changes after code review.
Signed-off-by: Dominik Fuchß <[email protected]>
  • Loading branch information
dfuchss authored and kesselb committed Jun 13, 2023
commit a4a57409db7500a781f339d52999183de83b6ff7
4 changes: 2 additions & 2 deletions config/config.sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,9 @@
'session_lifetime' => 60 * 60 * 24,

/**
* The timeout for requests to remote servers (e.g., needed for federated shares).
* The timeout in seconds for requests to servers made by the DAV component (e.g., needed for federated shares).
*/
'remote_curl_timeout' => 30,
'davstorage.request_timeout' => 30,

/**
* `true` enabled a relaxed session timeout, where the session timeout would no longer be
Expand Down
9 changes: 7 additions & 2 deletions lib/private/Files/Storage/DAV.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ class DAV extends Common {
protected LoggerInterface $logger;
protected IEventLogger $eventLogger;

/** @var int */
private $timeout;

/**
* @param array $params
* @throws \Exception
Expand Down Expand Up @@ -135,6 +138,8 @@ public function __construct($params) {
}
$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->getConfig()->getSystemValueInt('davstorage.request_timeout', 30);
}

protected function init() {
Expand Down Expand Up @@ -375,7 +380,7 @@ public function fopen($path, $mode) {
'auth' => [$this->user, $this->password],
'stream' => true,
// set download timeout for users with slow connections or large files
'timeout' => \OC::$server->getConfig()->getSystemValueInt('remote_curl_timeout', 30)
'timeout' => $this->timeout
]);
} catch (\GuzzleHttp\Exception\ClientException $e) {
if ($e->getResponse() instanceof ResponseInterface
Expand Down Expand Up @@ -534,7 +539,7 @@ protected function uploadFile($path, $target) {
'body' => $source,
'auth' => [$this->user, $this->password],
// set upload timeout for users with slow connections or large files
'timeout' => \OC::$server->getConfig()->getSystemValueInt('remote_curl_timeout', 30)
'timeout' => $this->timeout
]);

$this->removeCachedFile($target);
Expand Down