From 46df493ac069b48dff7673d9b2cf24aae891a0fc Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Mon, 27 Jun 2016 13:21:14 +0200 Subject: [PATCH] Remove incomplete and dated 'wgUseETag' experiment Follows-up: * 8ff36ebd (r9793) Set ETag header on article views. * 8167b89e (r16205) Add $wgUseETag, false by default (broke Squid; T9098). ETag is a useful alternative for If-Modified-Since (see T33639, T49529 about use cases and bugs it may fix). However the current incomplete implementation isn't useful. It's a feature flag that has been disabled since 2006. Enabling it stores ParserCache::getETag in OutputPage and sends it out as a response header. It's ignored on incoming requests. We don't check If-None-Match for '304 Not Modified' anywhere. ResourceLoader has a working implementation that could be leveraged. To be re-evaluated in the future. ParserCache::getETag() could use improvement as well. Change-Id: I37fd9d0ce1ce9bffb79243c6ae340403fdfd769f --- includes/DefaultSettings.php | 6 ------ includes/OutputPage.php | 24 ++++-------------------- includes/page/Article.php | 6 +----- 3 files changed, 5 insertions(+), 31 deletions(-) diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 39e22a0277..b8e1486376 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -2551,12 +2551,6 @@ $wgSidebarCacheExpiry = 86400; */ $wgUseGzip = false; -/** - * Whether MediaWiki should send an ETag header. Seems to cause - * broken behavior with Squid 2.6, see bug 7098. - */ -$wgUseETag = false; - /** * Clock skew or the one-second resolution of time() can occasionally cause cache * problems when the user requests two pages within a short period of time. This diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 5c7203d907..15b70c8324 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -104,22 +104,11 @@ class OutputPage extends ContextSource { protected $mStatusCode; /** - * @var string Variable mLastModified and mEtag are used for sending cache control. + * @var string Used for sending cache control. * The whole caching system should probably be moved into its own class. */ protected $mLastModified = ''; - /** - * Contains an HTTP Entity Tags (see RFC 2616 section 3.13) which is used - * as a unique identifier for the content. It is later used by the client - * to compare its cached version with the server version. Client sends - * headers If-Match and If-None-Match containing its locally cached ETAG value. - * - * To get more information, you will have to look at HTTP/1.1 protocol which - * is properly described in RFC 2616 : http://tools.ietf.org/html/rfc2616 - */ - private $mETag = false; - /** @var array */ protected $mCategoryLinks = []; @@ -694,12 +683,10 @@ class OutputPage extends ContextSource { } /** - * Set the value of the ETag HTTP header, only used if $wgUseETag is true - * - * @param string $tag Value of "ETag" header + * @deprecated since 1.28 Obsolete - wgUseETag experiment was removed. + * @param string $tag */ - function setETag( $tag ) { - $this->mETag = $tag; + public function setETag( $tag ) { } /** @@ -2156,9 +2143,6 @@ class OutputPage extends ContextSource { public function sendCacheControl() { $response = $this->getRequest()->response(); $config = $this->getConfig(); - if ( $config->get( 'UseETag' ) && $this->mETag ) { - $response->header( "ETag: $this->mETag" ); - } $this->addVaryHeader( 'Cookie' ); $this->addAcceptLanguage(); diff --git a/includes/page/Article.php b/includes/page/Article.php index 1f1e8d6f55..2a6f88c577 100644 --- a/includes/page/Article.php +++ b/includes/page/Article.php @@ -467,7 +467,7 @@ class Article implements Page { * page of the given title. */ public function view() { - global $wgUseFileCache, $wgUseETag, $wgDebugToolbar, $wgMaxRedirects; + global $wgUseFileCache, $wgDebugToolbar, $wgMaxRedirects; # Get variables from query string # As side effect this will load the revision and update the title @@ -520,10 +520,6 @@ class Article implements Page { # Try client and file cache if ( !$wgDebugToolbar && $oldid === 0 && $this->mPage->checkTouched() ) { - if ( $wgUseETag ) { - $outputPage->setETag( $parserCache->getETag( $this->mPage, $parserOptions ) ); - } - # Use the greatest of the page's timestamp or the timestamp of any # redirect in the chain (bug 67849) $timestamp = $this->mPage->getTouched(); -- 2.20.1