Browse Source
Merge pull request #48639 from nextcloud/add-default-request-timeout-const
feat(http client): expose default request timeout constant to be used instead of magic number 30
pull/48206/head
Thomas Citharel
1 year ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with
11 additions and
2 deletions
-
lib/private/Files/Storage/DAV.php
-
lib/private/Http/Client/Client.php
-
lib/public/Http/Client/IClient.php
|
|
|
@ -20,6 +20,7 @@ use OCP\Files\ForbiddenException; |
|
|
|
use OCP\Files\IMimeTypeDetector; |
|
|
|
use OCP\Files\StorageInvalidException; |
|
|
|
use OCP\Files\StorageNotAvailableException; |
|
|
|
use OCP\Http\Client\IClient; |
|
|
|
use OCP\Http\Client\IClientService; |
|
|
|
use OCP\ICertificateManager; |
|
|
|
use OCP\IConfig; |
|
|
|
@ -124,7 +125,7 @@ class DAV extends Common { |
|
|
|
$this->logger = Server::get(LoggerInterface::class); |
|
|
|
$this->eventLogger = Server::get(IEventLogger::class); |
|
|
|
// This timeout value will be used for the download and upload of files
|
|
|
|
$this->timeout = Server::get(IConfig::class)->getSystemValueInt('davstorage.request_timeout', 30); |
|
|
|
$this->timeout = Server::get(IConfig::class)->getSystemValueInt('davstorage.request_timeout', IClient::DEFAULT_REQUEST_TIMEOUT); |
|
|
|
$this->mimeTypeDetector = \OC::$server->getMimeTypeDetector(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -53,7 +53,7 @@ class Client implements IClient { |
|
|
|
|
|
|
|
$defaults = [ |
|
|
|
RequestOptions::VERIFY => $this->getCertBundle(), |
|
|
|
RequestOptions::TIMEOUT => 30, |
|
|
|
RequestOptions::TIMEOUT => IClient::DEFAULT_REQUEST_TIMEOUT, |
|
|
|
]; |
|
|
|
|
|
|
|
$options['nextcloud']['allow_local_address'] = $this->isLocalAddressAllowed($options); |
|
|
|
|
|
|
|
@ -14,6 +14,14 @@ namespace OCP\Http\Client; |
|
|
|
* @since 8.1.0 |
|
|
|
*/ |
|
|
|
interface IClient { |
|
|
|
|
|
|
|
/** |
|
|
|
* Default request timeout for requests |
|
|
|
* |
|
|
|
* @since 31.0.0 |
|
|
|
*/ |
|
|
|
public const DEFAULT_REQUEST_TIMEOUT = 30; |
|
|
|
|
|
|
|
/** |
|
|
|
* Sends a GET request |
|
|
|
* @param string $uri |
|
|
|
|