This commit is contained in:
shimon
2024-10-27 16:57:47 +02:00
parent 88075a75b9
commit 7c727ea818
3 changed files with 47 additions and 1 deletions
+1
View File
@@ -1299,6 +1299,7 @@ App::get('/v1/storage/buckets/:bucketId/files/:fileId/view')
$size = $deviceForFiles->getFileSize($path);
if ($size > APP_STORAGE_READ_BUFFER) {
for ($i = 0; $i < ceil($size / MAX_OUTPUT_CHUNK_SIZE); $i++) {
$response->chunk(
$deviceForFiles->read(
$path,
+4 -1
View File
@@ -473,7 +473,9 @@ App::init()
);
$timestamp = 60 * 60 * 24 * 30;
$data = $cache->load($key, $timestamp);
if (!empty($data) && !$cacheLog->isEmpty()) {
$parts = explode('/', $cacheLog->getAttribute('resourceType'));
$type = $parts[0] ?? null;
@@ -718,7 +720,7 @@ App::shutdown()
if ($useCache) {
$resource = $resourceType = null;
$data = $response->getPayload();
var_dump($response->getHeaders());
if (!empty($data['payload'])) {
$pattern = $route->getLabel('cache.resource', null);
@@ -735,6 +737,7 @@ App::shutdown()
if(!empty($request->getRangeStart())) $keyParams .= '*'.$request->getRangeStart();
if(!empty($request->getRangeEnd())) $keyParams .= '*'.$request->getRangeEnd();
$keyParams .= '*'. APP_CACHE_BUSTER;
$key = md5($keyParams);
$signature = md5($data['payload']);
$cacheLog = Authorization::skip(fn () => $dbForProject->getDocument('cache', $key));
+42
View File
@@ -694,6 +694,48 @@ class Response extends SwooleResponse
$this->send($body);
}
/**
* Output response
*
* Generate HTTP response output including the response header (+cookies) and body and prints them.
*
* @param string $body
* @param bool $end
*
* @return void
*/
public function bla(string $body = '', bool $end = false): void
{
if ($this->sent) {
return;
}
if ($end) {
$this->sent = true;
}
$this->addHeader('X-Debug-Speed', (string) (microtime(true) - $this->startTime));
$this
->appendCookies()
->appendHeaders();
$this->payload = [
'payload' => $body
];
if (!$this->disablePayload) {
$this->write($body);
if ($end) {
$this->disablePayload();
$this->end();
}
} else {
$this->end();
}
}
/**
* YAML
*