From 20a247e40eeba4712f0b179b82e8e090d89a7090 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Gerg=C5=91=20Tisza?= Date: Tue, 23 Feb 2016 22:45:04 -0800 Subject: [PATCH] Do not vary on session cookies when the session is disabled MW_NO_SESSION is supposed to be used in a deterministic way (either always or never for a given endpoint) so there is no point to split the cache on session cookies when it is used (except when it's set to 'warn' in which case it is not really used). Bug: T127233 Change-Id: If44e0ec2167359e081e1b4cd4d21e62bd357d23e --- includes/session/SessionManager.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/includes/session/SessionManager.php b/includes/session/SessionManager.php index 1aab12a895..b1d5d77e38 100644 --- a/includes/session/SessionManager.php +++ b/includes/session/SessionManager.php @@ -296,6 +296,9 @@ final class SessionManager implements SessionManagerInterface { } public function getVaryHeaders() { + if ( defined( 'MW_NO_SESSION' ) && MW_NO_SESSION !== 'warn' ) { + return []; + } if ( $this->varyHeaders === null ) { $headers = []; foreach ( $this->getProviders() as $provider ) { @@ -314,6 +317,9 @@ final class SessionManager implements SessionManagerInterface { } public function getVaryCookies() { + if ( defined( 'MW_NO_SESSION' ) && MW_NO_SESSION !== 'warn' ) { + return []; + } if ( $this->varyCookies === null ) { $cookies = []; foreach ( $this->getProviders() as $provider ) { -- 2.20.1