mirror of
https://github.com/nextcloud/server.git
synced 2026-06-10 17:23:59 -04:00
Merge pull request #32759 from nextcloud/backport/stable23/upload-speed
[stable23] Make X-HAS-{MD5/SHA256} opt-in
This commit is contained in:
commit
dd809633d9
1 changed files with 20 additions and 9 deletions
|
|
@ -212,15 +212,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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue