Deprecate $wgUseKeyHeader and OutputPage::getKeyHeader()
[lhc/web/wiklou.git] / includes / OutputPage.php
index 17e92cb..cde92e8 100644 (file)
@@ -2281,8 +2281,12 @@ class OutputPage extends ContextSource {
         * Get a complete Key header
         *
         * @return string
+        * @deprecated in 1.32; the IETF spec for this header expired w/o becoming
+        *   a standard.
         */
        public function getKeyHeader() {
+               wfDeprecated( '$wgUseKeyHeader', '1.32' );
+
                $cvCookies = $this->getCacheVaryCookies();
 
                $cookiesOption = [];
@@ -2330,6 +2334,16 @@ class OutputPage extends ContextSource {
                                        continue;
                                }
 
+                               // XXX Note that this code is not strictly correct: we
+                               // do a case-insensitive match in
+                               // LanguageConverter::getHeaderVariant() while the
+                               // (abandoned, draft) spec for the `Key` header only
+                               // allows case-sensitive matches.  To match the logic
+                               // in LanguageConverter::getHeaderVariant() we should
+                               // also be looking at fallback variants and deprecated
+                               // mediawiki-internal codes, as well as BCP 47
+                               // normalized forms.
+
                                $aloption[] = "substr=$variant";
 
                                // IE and some other browsers use BCP 47 standards in their Accept-Language header,