MaxSem has submitted this change and it was merged.

Change subject: Remove custom caching headers
......................................................................


Remove custom caching headers

According to commit summary[1], caching of responses to frontend
proxies was introduced as a stopgap. It doesn't seem needed now,
MF should rely on core for headers as much as possible.

----
[1] 
http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/MobileFrontend/MobileFrontend.php?revision=93405&view=markup

Change-Id: Ie7b3259fbddcbd71efd76c30dfe613d22ccca6a4
---
M includes/MobileFrontend.body.php
M tests/MobileFrontendTest.php
2 files changed, 0 insertions(+), 38 deletions(-)

Approvals:
  MaxSem: Verified; Looks good to me, approved



diff --git a/includes/MobileFrontend.body.php b/includes/MobileFrontend.body.php
index 9d822e0..aa61d95 100644
--- a/includes/MobileFrontend.body.php
+++ b/includes/MobileFrontend.body.php
@@ -31,33 +31,7 @@
 
                $this->setDefaultLogo();
 
-               $this->disableCaching();
                $this->sendHeaders();
-
-               wfProfileOut( __METHOD__ );
-       }
-
-       /**
-        * Disables caching if the request is coming from a trusted proxy
-        */
-       private function disableCaching() {
-               wfProfileIn( __METHOD__ );
-
-               // Fetch the REMOTE_ADDR and check if it's a trusted proxy.
-               // Is this enough, or should we actually step through the entire
-               // X-FORWARDED-FOR chain?
-               if ( isset( $_SERVER['REMOTE_ADDR'] ) ) {
-                       $ip = IP::canonicalize( $_SERVER['REMOTE_ADDR'] );
-               } else {
-                       $ip = null;
-               }
-
-               $request = $this->getRequest();
-               if ( wfIsConfiguredProxy( $ip ) ) {
-                       $request->response()->header( 'Cache-Control: no-cache, 
must-revalidate' );
-                       $request->response()->header( 'Expires: Sat, 26 Jul 
1997 05:00:00 GMT' );
-                       $request->response()->header( 'Pragma: no-cache' );
-               }
 
                wfProfileOut( __METHOD__ );
        }
diff --git a/tests/MobileFrontendTest.php b/tests/MobileFrontendTest.php
index 648d20e..78af19c 100644
--- a/tests/MobileFrontendTest.php
+++ b/tests/MobileFrontendTest.php
@@ -25,18 +25,6 @@
                MobileContext::setInstance( null ); // refresh it
        }
 
-       public function testDisableCaching() {
-               global $wgRequest, $wgExtMobileFrontend, $wgSquidServers;
-               $disableCaching = self::getMethod( 'disableCaching' );
-
-               $wgSquidServers = array( '10.64.0.131' );
-               $_SERVER['REMOTE_ADDR'] = '10.64.0.131';
-               $disableCaching->invokeArgs( $wgExtMobileFrontend, array() );
-               $this->assertEquals( 'no-cache, must-revalidate', 
$wgRequest->response()->getheader( 'Cache-Control' ) );
-               $this->assertEquals( 'Sat, 26 Jul 1997 05:00:00 GMT', 
$wgRequest->response()->getheader( 'Expires' ) );
-               $this->assertEquals( 'no-cache', 
$wgRequest->response()->getheader( 'Pragma' ) );
-       }
-
        public function testSendHeaders() {
                global $wgExtMobileFrontend, $wgMFVaryResources;
                $wgMFVaryResources = false;

-- 
To view, visit https://gerrit.wikimedia.org/r/68009
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie7b3259fbddcbd71efd76c30dfe613d22ccca6a4
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: MaxSem <[email protected]>
Gerrit-Reviewer: Asher <[email protected]>
Gerrit-Reviewer: Faidon <[email protected]>
Gerrit-Reviewer: Mark Bergsma <[email protected]>
Gerrit-Reviewer: MaxSem <[email protected]>
Gerrit-Reviewer: awjrichards <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to