From 38723fdc05d7bfb5ff4ff65a2838106ca3d0afc3 Mon Sep 17 00:00:00 2001 From: Oleksandr Yarosh Date: Tue, 28 Sep 2021 15:09:55 +0300 Subject: [PATCH] set content-length header for html if there is no compression active; --- PgCache_ContentGrabber.php | 9 +++++++++ composer.json | 2 +- w3-total-cache-api.php | 2 +- w3-total-cache.php | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/PgCache_ContentGrabber.php b/PgCache_ContentGrabber.php index e663c9711..cbe763f9e 100644 --- a/PgCache_ContentGrabber.php +++ b/PgCache_ContentGrabber.php @@ -2169,6 +2169,15 @@ private function _maybe_save_cached_result( $buffer, $response_headers, $has_dyn // Calculate content etag $etag = md5( $buffer ); + // Pass content-length in case there are no compression methods enabled + if( + $compressions_to_store === [false] && + $this->_config->get_boolean( 'browsercache.enabled' ) && + (!$this->_config->get_boolean( 'browsercache.html.compression' ) && !$this->_config->get_boolean( 'browsercache.html.brotli' )) + ){ + $headers['Content-Length'] = strlen($buffer); + } + // Send headers $this->_send_headers( $is_404, $time, $etag, $compression_header, $headers ); diff --git a/composer.json b/composer.json index c0d9d0a31..cfc2f4acf 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "glomex/w3-total-cache", "description": "Altered version of W3TC plugin with support for internal Glomex infrastructure", "type": "wordpress-plugin", - "version": "2.1.8.2", + "version": "2.1.8.3", "require-dev": { "roave/security-advisories": "dev-master" }, diff --git a/w3-total-cache-api.php b/w3-total-cache-api.php index 7ca658cb7..32580e14b 100644 --- a/w3-total-cache-api.php +++ b/w3-total-cache-api.php @@ -5,7 +5,7 @@ } define( 'W3TC', true ); -define( 'W3TC_VERSION', '2.1.8.2' ); +define( 'W3TC_VERSION', '2.1.8.3' ); define( 'W3TC_POWERED_BY', 'W3 Total Cache' ); define( 'W3TC_EMAIL', 'w3tc@w3-edge.com' ); define( 'W3TC_TEXT_DOMAIN', 'w3-total-cache' ); diff --git a/w3-total-cache.php b/w3-total-cache.php index 2ce87459d..fcfc4ed46 100644 --- a/w3-total-cache.php +++ b/w3-total-cache.php @@ -3,7 +3,7 @@ * Plugin Name: W3 Total Cache * Plugin URI: https://www.boldgrid.com/totalcache/ * Description: The highest rated and most complete WordPress performance plugin. Dramatically improve the speed and user experience of your site. Add browser, page, object and database caching as well as minify and content delivery network (CDN) to WordPress. - * Version: 2.1.8.2 + * Version: 2.1.8.3 * Requires at least: 3.8 * Requires PHP: 5.6 * Author: BoldGrid