From ce36392a37a84208e7473641bd473c57beb3d2bd Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Wed, 6 Nov 2024 18:56:40 +0100 Subject: [PATCH 01/12] chore: bump framework --- composer.json | 2 +- composer.lock | 124 ++++++++++++++++++++++++++++++++++++-------------- 2 files changed, 91 insertions(+), 35 deletions(-) diff --git a/composer.json b/composer.json index a04ca51d43..ac5d3a5412 100644 --- a/composer.json +++ b/composer.json @@ -54,7 +54,7 @@ "utopia-php/database": "0.53.16", "utopia-php/domains": "0.5.*", "utopia-php/dsn": "0.2.1", - "utopia-php/framework": "0.33.*", + "utopia-php/framework": "dev-feat-compression-0.33.x as 0.33.9", "utopia-php/fetch": "0.2.*", "utopia-php/image": "0.7.*", "utopia-php/locale": "0.4.*", diff --git a/composer.lock b/composer.lock index 6dce436601..69a4d41b71 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "b358198535c1867eabed7c0f99135a57", + "content-hash": "c53d2cc50894be845538b4a23ea8be94", "packages": [ { "name": "adhocore/jwt", @@ -1671,6 +1671,52 @@ }, "time": "2024-10-04T13:55:36+00:00" }, + { + "name": "utopia-php/compression", + "version": "0.1.0", + "source": { + "type": "git", + "url": "https://github.com/utopia-php/compression.git", + "reference": "8c6d9bcb5b0972faa27e5bf70923c20403aaf25c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/utopia-php/compression/zipball/8c6d9bcb5b0972faa27e5bf70923c20403aaf25c", + "reference": "8c6d9bcb5b0972faa27e5bf70923c20403aaf25c", + "shasum": "" + }, + "require": { + "php": ">=8.0" + }, + "require-dev": { + "laravel/pint": "1.2.*", + "phpunit/phpunit": "^9.3", + "vimeo/psalm": "4.0.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "Utopia\\Compression\\": "src/Compression" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A simple Compression library to handle file compression", + "keywords": [ + "compression", + "framework", + "php", + "upf", + "utopia" + ], + "support": { + "issues": "https://github.com/utopia-php/compression/issues", + "source": "https://github.com/utopia-php/compression/tree/0.1.0" + }, + "time": "2024-10-23T10:17:46+00:00" + }, { "name": "utopia-php/config", "version": "0.2.2", @@ -1926,20 +1972,21 @@ }, { "name": "utopia-php/framework", - "version": "0.33.8", + "version": "dev-feat-compression-0.33.x", "source": { "type": "git", "url": "https://github.com/utopia-php/http.git", - "reference": "a7f577540a25cb90896fef2b64767bf8d700f3c5" + "reference": "a501a56f89097f2fd48c13eb2c632aafb1285cff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/http/zipball/a7f577540a25cb90896fef2b64767bf8d700f3c5", - "reference": "a7f577540a25cb90896fef2b64767bf8d700f3c5", + "url": "https://api.github.com/repos/utopia-php/http/zipball/a501a56f89097f2fd48c13eb2c632aafb1285cff", + "reference": "a501a56f89097f2fd48c13eb2c632aafb1285cff", "shasum": "" }, "require": { - "php": ">=8.0" + "php": ">=8.0", + "utopia-php/compression": "0.1.*" }, "require-dev": { "laravel/pint": "^1.2", @@ -1965,9 +2012,9 @@ ], "support": { "issues": "https://github.com/utopia-php/http/issues", - "source": "https://github.com/utopia-php/http/tree/0.33.8" + "source": "https://github.com/utopia-php/http/tree/feat-compression-0.33.x" }, - "time": "2024-08-15T14:10:09+00:00" + "time": "2024-11-01T17:05:05+00:00" }, { "name": "utopia-php/image", @@ -2608,16 +2655,16 @@ }, { "name": "utopia-php/storage", - "version": "0.18.5", + "version": "0.18.6", "source": { "type": "git", "url": "https://github.com/utopia-php/storage.git", - "reference": "7d355c5e3ccc8ecebc0266f8ddd30088a43be919" + "reference": "893ccf06e183f8ece2aed8dbf14d64d6ba036071" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/storage/zipball/7d355c5e3ccc8ecebc0266f8ddd30088a43be919", - "reference": "7d355c5e3ccc8ecebc0266f8ddd30088a43be919", + "url": "https://api.github.com/repos/utopia-php/storage/zipball/893ccf06e183f8ece2aed8dbf14d64d6ba036071", + "reference": "893ccf06e183f8ece2aed8dbf14d64d6ba036071", "shasum": "" }, "require": { @@ -2657,9 +2704,9 @@ ], "support": { "issues": "https://github.com/utopia-php/storage/issues", - "source": "https://github.com/utopia-php/storage/tree/0.18.5" + "source": "https://github.com/utopia-php/storage/tree/0.18.6" }, - "time": "2024-09-04T08:57:27+00:00" + "time": "2024-11-06T09:58:50+00:00" }, { "name": "utopia-php/swoole", @@ -4004,16 +4051,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.5.0", + "version": "5.5.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "54e10d44fc1a84e2598d26f70d4f6f1f233e228a" + "reference": "0c70d2c566e899666f367ab7b80986beb3581e6f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/54e10d44fc1a84e2598d26f70d4f6f1f233e228a", - "reference": "54e10d44fc1a84e2598d26f70d4f6f1f233e228a", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/0c70d2c566e899666f367ab7b80986beb3581e6f", + "reference": "0c70d2c566e899666f367ab7b80986beb3581e6f", "shasum": "" }, "require": { @@ -4062,9 +4109,9 @@ "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", "support": { "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.5.0" + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.5.1" }, - "time": "2024-11-04T21:26:31+00:00" + "time": "2024-11-06T11:58:54+00:00" }, { "name": "phpdocumentor/type-resolver", @@ -5875,16 +5922,16 @@ }, { "name": "symfony/console", - "version": "v7.1.6", + "version": "v7.1.7", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "bb5192af6edc797cbab5c8e8ecfea2fe5f421e57" + "reference": "3284aafcac338b6e86fd955ee4d794cbe434151a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/bb5192af6edc797cbab5c8e8ecfea2fe5f421e57", - "reference": "bb5192af6edc797cbab5c8e8ecfea2fe5f421e57", + "url": "https://api.github.com/repos/symfony/console/zipball/3284aafcac338b6e86fd955ee4d794cbe434151a", + "reference": "3284aafcac338b6e86fd955ee4d794cbe434151a", "shasum": "" }, "require": { @@ -5948,7 +5995,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v7.1.6" + "source": "https://github.com/symfony/console/tree/v7.1.7" }, "funding": [ { @@ -5964,7 +6011,7 @@ "type": "tidelift" } ], - "time": "2024-10-09T08:46:59+00:00" + "time": "2024-11-05T15:34:55+00:00" }, { "name": "symfony/deprecation-contracts", @@ -6546,16 +6593,16 @@ }, { "name": "symfony/process", - "version": "v7.1.6", + "version": "v7.1.7", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "6aaa189ddb4ff6b5de8fa3210f2fb42c87b4d12e" + "reference": "9b8a40b7289767aa7117e957573c2a535efe6585" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/6aaa189ddb4ff6b5de8fa3210f2fb42c87b4d12e", - "reference": "6aaa189ddb4ff6b5de8fa3210f2fb42c87b4d12e", + "url": "https://api.github.com/repos/symfony/process/zipball/9b8a40b7289767aa7117e957573c2a535efe6585", + "reference": "9b8a40b7289767aa7117e957573c2a535efe6585", "shasum": "" }, "require": { @@ -6587,7 +6634,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v7.1.6" + "source": "https://github.com/symfony/process/tree/v7.1.7" }, "funding": [ { @@ -6603,7 +6650,7 @@ "type": "tidelift" } ], - "time": "2024-09-25T14:20:29+00:00" + "time": "2024-11-06T09:25:12+00:00" }, { "name": "symfony/service-contracts", @@ -7003,9 +7050,18 @@ "time": "2024-03-07T20:33:40+00:00" } ], - "aliases": [], + "aliases": [ + { + "package": "utopia-php/framework", + "version": "dev-feat-compression-0.33.x", + "alias": "0.33.9", + "alias_normalized": "0.33.9.0" + } + ], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": { + "utopia-php/framework": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": { From 35c2978b7416d4dfccf9f1c220570bbb023f05e0 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Wed, 6 Nov 2024 19:01:18 +0100 Subject: [PATCH 02/12] fix: test warning --- tests/e2e/Services/FunctionsSchedule/FunctionsScheduleTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/e2e/Services/FunctionsSchedule/FunctionsScheduleTest.php b/tests/e2e/Services/FunctionsSchedule/FunctionsScheduleTest.php index b1315103b1..4f4b0c960d 100644 --- a/tests/e2e/Services/FunctionsSchedule/FunctionsScheduleTest.php +++ b/tests/e2e/Services/FunctionsSchedule/FunctionsScheduleTest.php @@ -1,12 +1,13 @@ Date: Thu, 7 Nov 2024 16:50:33 +0100 Subject: [PATCH 03/12] chore: bump composer --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 69a4d41b71..40c63c74ad 100644 --- a/composer.lock +++ b/composer.lock @@ -6923,16 +6923,16 @@ }, { "name": "twig/twig", - "version": "v3.14.0", + "version": "v3.14.2", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "126b2c97818dbff0cdf3fbfc881aedb3d40aae72" + "reference": "0b6f9d8370bb3b7f1ce5313ed8feb0fafd6e399a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/126b2c97818dbff0cdf3fbfc881aedb3d40aae72", - "reference": "126b2c97818dbff0cdf3fbfc881aedb3d40aae72", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/0b6f9d8370bb3b7f1ce5313ed8feb0fafd6e399a", + "reference": "0b6f9d8370bb3b7f1ce5313ed8feb0fafd6e399a", "shasum": "" }, "require": { @@ -6986,7 +6986,7 @@ ], "support": { "issues": "https://github.com/twigphp/Twig/issues", - "source": "https://github.com/twigphp/Twig/tree/v3.14.0" + "source": "https://github.com/twigphp/Twig/tree/v3.14.2" }, "funding": [ { @@ -6998,7 +6998,7 @@ "type": "tidelift" } ], - "time": "2024-09-09T17:55:12+00:00" + "time": "2024-11-07T12:36:22+00:00" }, { "name": "webmozart/glob", From 71eba6a879f8fb84ef3b2472619f9a2b5a71b839 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Thu, 7 Nov 2024 18:21:41 +0100 Subject: [PATCH 04/12] fix: tests --- app/http.php | 4 +- composer.lock | 8 +- tests/e2e/General/CompressionTest.php | 138 ++++++++++++++++++++++++++ 3 files changed, 144 insertions(+), 6 deletions(-) create mode 100644 tests/e2e/General/CompressionTest.php diff --git a/app/http.php b/app/http.php index bec772c770..5a95b25f67 100644 --- a/app/http.php +++ b/app/http.php @@ -39,8 +39,7 @@ $http ->set([ 'worker_num' => $workerNumber, 'open_http2_protocol' => true, - 'http_compression' => true, - 'http_compression_level' => 6, + 'http_compression' => false, 'package_max_length' => $payloadSize, 'buffer_output_size' => $payloadSize, ]); @@ -61,6 +60,7 @@ include __DIR__ . '/controllers/general.php'; $http->on(Constant::EVENT_START, function (Server $http) use ($payloadSize, $register) { $app = new App('UTC'); + $app->setCompression(true); go(function () use ($register, $app) { $pools = $register->get('pools'); diff --git a/composer.lock b/composer.lock index 40c63c74ad..c00875c600 100644 --- a/composer.lock +++ b/composer.lock @@ -1976,12 +1976,12 @@ "source": { "type": "git", "url": "https://github.com/utopia-php/http.git", - "reference": "a501a56f89097f2fd48c13eb2c632aafb1285cff" + "reference": "72239fb95a65fc65e3a8e435f1645e234b00ea04" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/http/zipball/a501a56f89097f2fd48c13eb2c632aafb1285cff", - "reference": "a501a56f89097f2fd48c13eb2c632aafb1285cff", + "url": "https://api.github.com/repos/utopia-php/http/zipball/72239fb95a65fc65e3a8e435f1645e234b00ea04", + "reference": "72239fb95a65fc65e3a8e435f1645e234b00ea04", "shasum": "" }, "require": { @@ -2014,7 +2014,7 @@ "issues": "https://github.com/utopia-php/http/issues", "source": "https://github.com/utopia-php/http/tree/feat-compression-0.33.x" }, - "time": "2024-11-01T17:05:05+00:00" + "time": "2024-11-07T17:00:49+00:00" }, { "name": "utopia-php/image", diff --git a/tests/e2e/General/CompressionTest.php b/tests/e2e/General/CompressionTest.php new file mode 100644 index 0000000000..2a565ff34d --- /dev/null +++ b/tests/e2e/General/CompressionTest.php @@ -0,0 +1,138 @@ +client->call(Client::METHOD_GET, '/ping', [ + 'accept-encoding' => 'gzip', + 'x-appwrite-project' => $this->getProject()['$id'], + ]); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertEquals('Pong!', $response['body']); + $this->assertLessThan(1024, strlen($response['body'])); + $this->assertArrayNotHasKey('content-encoding', $response['headers']); + + // without header + $response = $this->client->call(Client::METHOD_GET, '/ping', [ + 'x-appwrite-project' => $this->getProject()['$id'], + ]); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertEquals('Pong!', $response['body']); + $this->assertLessThan(1024, strlen($response['body'])); + $this->assertArrayNotHasKey('content-encoding', $response['headers']); + } + + public function testLargeResponse() + { + // create an anonymous user + $response = $this->client->call(Client::METHOD_POST, '/users', array_merge([ + 'x-appwrite-project' => $this->getProject()['$id'], + 'content-type' => 'application/json', + ], $this->getHeaders()), [ + 'userId' => ID::unique(), + 'email' => 'test@localhost.test', + 'password' => 'password', + 'name' => 'User Name', + ]); + $this->assertEquals(201, $response['headers']['status-code']); + $userId = $response['body']['$id']; + + // set prefs with 2000 bytes of data + $prefs = ["longValue" => str_repeat('a', 2000)]; + + $response = $this->client->call(Client::METHOD_PATCH, '/users/' . $userId . '/prefs', array_merge([ + 'x-appwrite-project' => $this->getProject()['$id'], + 'content-type' => 'application/json', + ], $this->getHeaders()), [ + 'prefs' => $prefs, + ]); + + $this->assertEquals(200, $response['headers']['status-code']); + + // get prefs with compression + $response = $this->client->call(Client::METHOD_GET, '/users/' . $userId . '/prefs', array_merge([ + 'x-appwrite-project' => $this->getProject()['$id'], + 'accept-encoding' => 'gzip', + ], $this->getHeaders())); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertArrayHasKey('content-encoding', $response['headers'], 'Content encoding should be gzip, headers received: ' . json_encode($response['headers'], JSON_PRETTY_PRINT)); + $this->assertLessThan(2000, intval($response['headers']['content-length'])); + + // get prefs without compression + $response = $this->client->call(Client::METHOD_GET, '/users/' . $userId . '/prefs', array_merge([ + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders())); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertGreaterThanOrEqual(2000, intval($response['headers']['content-length'])); + $this->assertArrayNotHasKey('content-encoding', $response['headers']); + } + + public function testImageResponse() + { + // create bucket + $bucket = $this->client->call(Client::METHOD_POST, '/storage/buckets', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'bucketId' => ID::unique(), + 'name' => 'Test Bucket', + 'fileSecurity' => true, + ]); + $bucketId = $bucket['body']['$id']; + $this->assertEquals(201, $bucket['headers']['status-code']); + + // upload image + $file = $this->client->call(Client::METHOD_POST, '/storage/buckets/' . $bucketId . '/files', array_merge([ + 'content-type' => 'multipart/form-data', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'fileId' => ID::unique(), + 'file' => new CURLFile(realpath(__DIR__ . '/../../../resources/logo.png'), 'image/png', 'logo.png'), + 'permissions' => [ + Permission::read(Role::any()), + Permission::update(Role::any()), + Permission::delete(Role::any()), + ], + ]); + $fileId = $file['body']['$id']; + + // get image with header + $response = $this->client->call(Client::METHOD_GET, '/storage/buckets/' . $bucketId . '/files/' . $fileId, array_merge([ + 'content-type' => 'application/json', + 'accept-encoding' => 'gzip', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders())); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertEquals('gzip', $response['headers']['content-encoding']); + + // get image without + $response = $this->client->call(Client::METHOD_GET, '/storage/buckets/' . $bucketId . '/files/' . $fileId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders())); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertArrayNotHasKey('content-encoding', $response['headers']); + } +} From 83cbddb9267e4ad4735268c2169c5598e63b2486 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Thu, 7 Nov 2024 20:31:12 +0100 Subject: [PATCH 05/12] fix: test --- app/http.php | 1 + tests/e2e/Client.php | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/app/http.php b/app/http.php index 5a95b25f67..87472a3fbe 100644 --- a/app/http.php +++ b/app/http.php @@ -244,6 +244,7 @@ $http->on('request', function (SwooleRequest $swooleRequest, SwooleResponse $swo } $app = new App('UTC'); + $app->setCompression(true); $pools = $register->get('pools'); App::setResource('pools', fn () => $pools); diff --git a/tests/e2e/Client.php b/tests/e2e/Client.php index 0774f1c6fd..2bcabd7c61 100644 --- a/tests/e2e/Client.php +++ b/tests/e2e/Client.php @@ -221,6 +221,10 @@ class Client curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); } + if (isset($headers['accept-encoding'])) { + curl_setopt($ch, CURLOPT_ENCODING, $headers['accept-encoding']); // Enable automatic decoding + } + $responseBody = curl_exec($ch); $responseType = $responseHeaders['content-type'] ?? ''; $responseStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE); From ee4b54857f3287906b35946a55844839a6524024 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Fri, 8 Nov 2024 13:01:18 +0100 Subject: [PATCH 06/12] fix: tests --- tests/e2e/Client.php | 17 ++++++++++------- tests/e2e/General/CompressionTest.php | 5 ++--- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/tests/e2e/Client.php b/tests/e2e/Client.php index 2bcabd7c61..cb8fd44cb3 100644 --- a/tests/e2e/Client.php +++ b/tests/e2e/Client.php @@ -179,9 +179,14 @@ class Client default => http_build_query($params), }; - foreach ($headers as $i => $header) { - $headers[] = $i . ':' . $header; - unset($headers[$i]); + $formattedHeaders = []; + foreach ($headers as $key => $value) { + if (strtolower($key) === 'accept-encoding') { + curl_setopt($ch, CURLOPT_ENCODING, $value); + continue; + } else { + $formattedHeaders[] = $key . ': ' . $value; + } } curl_setopt($ch, CURLOPT_PATH_AS_IS, 1); @@ -189,7 +194,7 @@ class Client curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36'); - curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); + curl_setopt($ch, CURLOPT_HTTPHEADER, $formattedHeaders); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0); curl_setopt($ch, CURLOPT_TIMEOUT, 15); curl_setopt($ch, CURLOPT_HEADERFUNCTION, function ($curl, $header) use (&$responseHeaders, &$cookies) { @@ -221,9 +226,7 @@ class Client curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); } - if (isset($headers['accept-encoding'])) { - curl_setopt($ch, CURLOPT_ENCODING, $headers['accept-encoding']); // Enable automatic decoding - } + curl_setopt($ch, CURLOPT_VERBOSE, true); $responseBody = curl_exec($ch); $responseType = $responseHeaders['content-type'] ?? ''; diff --git a/tests/e2e/General/CompressionTest.php b/tests/e2e/General/CompressionTest.php index 2a565ff34d..9affacfe0a 100644 --- a/tests/e2e/General/CompressionTest.php +++ b/tests/e2e/General/CompressionTest.php @@ -107,7 +107,7 @@ class CompressionTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ 'fileId' => ID::unique(), - 'file' => new CURLFile(realpath(__DIR__ . '/../../../resources/logo.png'), 'image/png', 'logo.png'), + 'file' => new CURLFile(realpath(__DIR__ . '/../../resources/logo.png'), 'image/png', 'logo.png'), 'permissions' => [ Permission::read(Role::any()), Permission::update(Role::any()), @@ -124,8 +124,7 @@ class CompressionTest extends Scope ], $this->getHeaders())); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertEquals('gzip', $response['headers']['content-encoding']); - + $this->assertArrayNotHasKey('content-encoding', $response['headers']); // get image without $response = $this->client->call(Client::METHOD_GET, '/storage/buckets/' . $bucketId . '/files/' . $fileId, array_merge([ 'content-type' => 'application/json', From e43887c53b950c733208bed9a1566869bea9d412 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Fri, 8 Nov 2024 13:06:09 +0100 Subject: [PATCH 07/12] feat: remove verbose --- tests/e2e/Client.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/e2e/Client.php b/tests/e2e/Client.php index cb8fd44cb3..dc80808b14 100644 --- a/tests/e2e/Client.php +++ b/tests/e2e/Client.php @@ -225,9 +225,6 @@ class Client curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); } - - curl_setopt($ch, CURLOPT_VERBOSE, true); - $responseBody = curl_exec($ch); $responseType = $responseHeaders['content-type'] ?? ''; $responseStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE); From c8c4dd28df552e4d17552fb150b09237d36a7e14 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Fri, 8 Nov 2024 13:28:01 +0100 Subject: [PATCH 08/12] chore: composer update --- composer.lock | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/composer.lock b/composer.lock index c00875c600..6727e73bff 100644 --- a/composer.lock +++ b/composer.lock @@ -1673,16 +1673,16 @@ }, { "name": "utopia-php/compression", - "version": "0.1.0", + "version": "0.1.1", "source": { "type": "git", "url": "https://github.com/utopia-php/compression.git", - "reference": "8c6d9bcb5b0972faa27e5bf70923c20403aaf25c" + "reference": "2ac5709e39823dbccb9fa66099ccebe809078c2e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/compression/zipball/8c6d9bcb5b0972faa27e5bf70923c20403aaf25c", - "reference": "8c6d9bcb5b0972faa27e5bf70923c20403aaf25c", + "url": "https://api.github.com/repos/utopia-php/compression/zipball/2ac5709e39823dbccb9fa66099ccebe809078c2e", + "reference": "2ac5709e39823dbccb9fa66099ccebe809078c2e", "shasum": "" }, "require": { @@ -1713,9 +1713,9 @@ ], "support": { "issues": "https://github.com/utopia-php/compression/issues", - "source": "https://github.com/utopia-php/compression/tree/0.1.0" + "source": "https://github.com/utopia-php/compression/tree/0.1.1" }, - "time": "2024-10-23T10:17:46+00:00" + "time": "2024-11-08T12:22:15+00:00" }, { "name": "utopia-php/config", @@ -1976,12 +1976,12 @@ "source": { "type": "git", "url": "https://github.com/utopia-php/http.git", - "reference": "72239fb95a65fc65e3a8e435f1645e234b00ea04" + "reference": "58851dc88c4d8ac32757f30f1508cdf55a26cb4a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/http/zipball/72239fb95a65fc65e3a8e435f1645e234b00ea04", - "reference": "72239fb95a65fc65e3a8e435f1645e234b00ea04", + "url": "https://api.github.com/repos/utopia-php/http/zipball/58851dc88c4d8ac32757f30f1508cdf55a26cb4a", + "reference": "58851dc88c4d8ac32757f30f1508cdf55a26cb4a", "shasum": "" }, "require": { @@ -2014,7 +2014,7 @@ "issues": "https://github.com/utopia-php/http/issues", "source": "https://github.com/utopia-php/http/tree/feat-compression-0.33.x" }, - "time": "2024-11-07T17:00:49+00:00" + "time": "2024-11-08T12:23:25+00:00" }, { "name": "utopia-php/image", From 56c43560f1c2f2c31d98236a2e905355b647e60d Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Fri, 8 Nov 2024 13:41:29 +0100 Subject: [PATCH 09/12] chore: composer update --- composer.json | 2 +- composer.lock | 27 +++++++++------------------ 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/composer.json b/composer.json index 15b2c9af90..5c2441fd1b 100644 --- a/composer.json +++ b/composer.json @@ -54,7 +54,7 @@ "utopia-php/database": "0.53.19", "utopia-php/domains": "0.5.*", "utopia-php/dsn": "0.2.1", - "utopia-php/framework": "dev-feat-compression-0.33.x as 0.33.9", + "utopia-php/framework": "0.33.*", "utopia-php/fetch": "0.2.*", "utopia-php/image": "0.7.*", "utopia-php/locale": "0.4.*", diff --git a/composer.lock b/composer.lock index 6425354bcd..e007c4eac9 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "6786247bf3743103412df3642d68dbb5", + "content-hash": "5be1b916c221b97b77b0e7f14491aabf", "packages": [ { "name": "adhocore/jwt", @@ -1972,16 +1972,16 @@ }, { "name": "utopia-php/framework", - "version": "dev-feat-compression-0.33.x", + "version": "0.33.9", "source": { "type": "git", "url": "https://github.com/utopia-php/http.git", - "reference": "58851dc88c4d8ac32757f30f1508cdf55a26cb4a" + "reference": "82c7252c02ae39a027592175f2732df27c167db4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/http/zipball/58851dc88c4d8ac32757f30f1508cdf55a26cb4a", - "reference": "58851dc88c4d8ac32757f30f1508cdf55a26cb4a", + "url": "https://api.github.com/repos/utopia-php/http/zipball/82c7252c02ae39a027592175f2732df27c167db4", + "reference": "82c7252c02ae39a027592175f2732df27c167db4", "shasum": "" }, "require": { @@ -2012,9 +2012,9 @@ ], "support": { "issues": "https://github.com/utopia-php/http/issues", - "source": "https://github.com/utopia-php/http/tree/feat-compression-0.33.x" + "source": "https://github.com/utopia-php/http/tree/0.33.9" }, - "time": "2024-11-08T12:23:25+00:00" + "time": "2024-11-08T12:39:51+00:00" }, { "name": "utopia-php/image", @@ -7050,18 +7050,9 @@ "time": "2024-03-07T20:33:40+00:00" } ], - "aliases": [ - { - "package": "utopia-php/framework", - "version": "dev-feat-compression-0.33.x", - "alias": "0.33.9", - "alias_normalized": "0.33.9.0" - } - ], + "aliases": [], "minimum-stability": "stable", - "stability-flags": { - "utopia-php/framework": 20 - }, + "stability-flags": {}, "prefer-stable": false, "prefer-lowest": false, "platform": { From 4b9457acc5a69c0e0a1dae1356009e38ba60f4b8 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Fri, 8 Nov 2024 16:03:32 +0100 Subject: [PATCH 10/12] chore: bump compression --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index e007c4eac9..1ea0a1a048 100644 --- a/composer.lock +++ b/composer.lock @@ -1673,16 +1673,16 @@ }, { "name": "utopia-php/compression", - "version": "0.1.1", + "version": "0.1.2", "source": { "type": "git", "url": "https://github.com/utopia-php/compression.git", - "reference": "2ac5709e39823dbccb9fa66099ccebe809078c2e" + "reference": "6062f70596415f8d5de40a589367b0eb2a435f98" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/compression/zipball/2ac5709e39823dbccb9fa66099ccebe809078c2e", - "reference": "2ac5709e39823dbccb9fa66099ccebe809078c2e", + "url": "https://api.github.com/repos/utopia-php/compression/zipball/6062f70596415f8d5de40a589367b0eb2a435f98", + "reference": "6062f70596415f8d5de40a589367b0eb2a435f98", "shasum": "" }, "require": { @@ -1713,9 +1713,9 @@ ], "support": { "issues": "https://github.com/utopia-php/compression/issues", - "source": "https://github.com/utopia-php/compression/tree/0.1.1" + "source": "https://github.com/utopia-php/compression/tree/0.1.2" }, - "time": "2024-11-08T12:22:15+00:00" + "time": "2024-11-08T14:59:54+00:00" }, { "name": "utopia-php/config", From cd817dbc0f6a68fd7ef7627eae000cfa7f9afba0 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Fri, 8 Nov 2024 16:04:33 +0100 Subject: [PATCH 11/12] chore: bump framework --- docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.yml b/docker-compose.yml index f2845dc137..79c6a82420 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -83,6 +83,7 @@ services: - ./public:/usr/src/code/public - ./src:/usr/src/code/src - ./dev:/usr/src/code/dev + - ./vendor:/usr/src/code/vendor depends_on: - mariadb - redis From d37c0500fc77c4a43924280e9a1ac16a4f87beac Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Fri, 8 Nov 2024 16:11:30 +0100 Subject: [PATCH 12/12] chore: bump framework, remove vender mount --- composer.lock | 12 ++++++------ docker-compose.yml | 1 - 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index 1ea0a1a048..0bcc5669ea 100644 --- a/composer.lock +++ b/composer.lock @@ -1972,16 +1972,16 @@ }, { "name": "utopia-php/framework", - "version": "0.33.9", + "version": "0.33.10", "source": { "type": "git", "url": "https://github.com/utopia-php/http.git", - "reference": "82c7252c02ae39a027592175f2732df27c167db4" + "reference": "247b934529ab9bcde7d39d6e6212cefcccfc3b20" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/http/zipball/82c7252c02ae39a027592175f2732df27c167db4", - "reference": "82c7252c02ae39a027592175f2732df27c167db4", + "url": "https://api.github.com/repos/utopia-php/http/zipball/247b934529ab9bcde7d39d6e6212cefcccfc3b20", + "reference": "247b934529ab9bcde7d39d6e6212cefcccfc3b20", "shasum": "" }, "require": { @@ -2012,9 +2012,9 @@ ], "support": { "issues": "https://github.com/utopia-php/http/issues", - "source": "https://github.com/utopia-php/http/tree/0.33.9" + "source": "https://github.com/utopia-php/http/tree/0.33.10" }, - "time": "2024-11-08T12:39:51+00:00" + "time": "2024-11-08T15:02:59+00:00" }, { "name": "utopia-php/image", diff --git a/docker-compose.yml b/docker-compose.yml index 79c6a82420..f2845dc137 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -83,7 +83,6 @@ services: - ./public:/usr/src/code/public - ./src:/usr/src/code/src - ./dev:/usr/src/code/dev - - ./vendor:/usr/src/code/vendor depends_on: - mariadb - redis