Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2022-06-01 11:59:04 +0300
committerCarl Schwan <carl@carlschwan.eu>2022-06-08 14:39:30 +0300
commit43e8f89a2180f73d926f16ac9c4322004753664d (patch)
tree71e5717dd4cd97874424fa8373d1cfe764b8e52f
parent84eee97e37a1863a5cc04816f87af7d7dbfa85c9 (diff)
Make X-HAS-{MD5/SHA256} opt-inbackport/stable24/upload-speed
This is not always needed and slow down the upload Signed-off-by: Carl Schwan <carl@carlschwan.eu> (cherry picked from commit 1b426eda44f59648d2f1c5b79a06c78ff74c9fce)
-rw-r--r--apps/dav/lib/Connector/Sabre/File.php29
1 files changed, 20 insertions, 9 deletions
diff --git a/apps/dav/lib/Connector/Sabre/File.php b/apps/dav/lib/Connector/Sabre/File.php
index 6c379984995..00c7c779eee 100644
--- a/apps/dav/lib/Connector/Sabre/File.php
+++ b/apps/dav/lib/Connector/Sabre/File.php
@@ -215,15 +215,26 @@ class File extends Node implements IFile {
$data = $tmpData;
}
- $data = HashWrapper::wrap($data, 'md5', function ($hash) {
- $this->header('X-Hash-MD5: ' . $hash);
- });
- $data = HashWrapper::wrap($data, 'sha1', function ($hash) {
- $this->header('X-Hash-SHA1: ' . $hash);
- });
- $data = HashWrapper::wrap($data, 'sha256', function ($hash) {
- $this->header('X-Hash-SHA256: ' . $hash);
- });
+ if ($this->request->getHeader('X-HASH') !== '') {
+ $hash = $this->request->getHeader('X-HASH');
+ if ($hash === 'all' || $hash === 'md5') {
+ $data = HashWrapper::wrap($data, 'md5', function ($hash) {
+ $this->header('X-Hash-MD5: ' . $hash);
+ });
+ }
+
+ if ($hash === 'all' || $hash === 'sha1') {
+ $data = HashWrapper::wrap($data, 'sha1', function ($hash) {
+ $this->header('X-Hash-SHA1: ' . $hash);
+ });
+ }
+
+ if ($hash === 'all' || $hash === 'sha256') {
+ $data = HashWrapper::wrap($data, 'sha256', function ($hash) {
+ $this->header('X-Hash-SHA256: ' . $hash);
+ });
+ }
+ }
if ($partStorage->instanceOfStorage(Storage\IWriteStreamStorage::class)) {
$isEOF = false;