diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index 37fe359..ec99d47 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -11,7 +11,7 @@ jobs: strategy: matrix: - php-version: [8.0, 8.1, 8.2, 8.3, 8.4] + php-version: [8.0, 8.1, 8.2, 8.3, 8.4, 8.5] name: PHP ${{ matrix.php-version }} tests steps: diff --git a/src/HostByBelle/CompressionBuffer.php b/src/HostByBelle/CompressionBuffer.php index 16c9532..1a8d7af 100644 --- a/src/HostByBelle/CompressionBuffer.php +++ b/src/HostByBelle/CompressionBuffer.php @@ -120,9 +120,6 @@ public static function handler(string $buffer, int $phase = PHP_OUTPUT_HANDLER_F } } } - - // We will return the original uncompressed content next, so tag the encoding as "identity" - self::sendHeader('Content-Encoding', 'identity'); } return $buffer; @@ -215,6 +212,11 @@ private static function doCompression(string $encoding, string $buffer): string */ private static function sendHeader(string $name, string|int $value): void { + // We actually don't want to send a `Content-Encoding` header if the content isn't encoded as this behavior risks confusing the client. + if ($name === 'Content-Encoding' && $value === 'identity') { + return; + } + if (is_callable(self::$headerHandler)) { call_user_func(self::$headerHandler, $name, $value); } else {