Change default of $wgResourceLoaderMaxQueryLength to 2000
authorJan Zerebecki <jan.wikimedia@zerebecki.de>
Thu, 26 Feb 2015 16:51:13 +0000 (17:51 +0100)
committerJan Zerebecki <jan.wikimedia@zerebecki.de>
Fri, 27 Mar 2015 22:23:06 +0000 (23:23 +0100)
The lowest commonly supported length is a bit over 2000.  That is the limit of
Internet Explorer.  For discussion of the IE limit see
http://blogs.msdn.com/b/ieinternals/archive/2014/08/13/url-length-limits-in-internet-explorer.aspx .
Some servers only support 4k.

Having it unlimited does not work when running qunit jenkins test jobs of the
Wikibase extension or when running its qunit tests in vagrant, because it hits
the nginx limit.

This also adds a mw.track call for when the request split happens.

Bug: T90453
Change-Id: Ic416def846f361425c46f7bd1022ed85fa8ac85e

includes/Setup.php
resources/src/mediawiki/mediawiki.js

index 6939f95..e4b29f0 100644 (file)
@@ -362,10 +362,15 @@ if ( $wgMetaNamespace === false ) {
        $wgMetaNamespace = str_replace( ' ', '_', $wgSitename );
 }
 
-// Default value is either the suhosin limit or -1 for unlimited
+// Default value is 2000 or the suhosin limit if it is between 1 and 2000
 if ( $wgResourceLoaderMaxQueryLength === false ) {
-       $maxValueLength = ini_get( 'suhosin.get.max_value_length' );
-       $wgResourceLoaderMaxQueryLength = $maxValueLength > 0 ? $maxValueLength : -1;
+       $suhosinMaxValueLength = (int) ini_get( 'suhosin.get.max_value_length' );
+       if ( $suhosinMaxValueLength > 0 && $suhosinMaxValueLength < 2000 ) {
+               $wgResourceLoaderMaxQueryLength = $suhosinMaxValueLength;
+       } else {
+               $wgResourceLoaderMaxQueryLength = 2000;
+       }
+       unset($suhosinMaxValueLength);
 }
 
 /**
index 2e78c1c..f03c7c6 100644 (file)
                                        };
                                        // Split module batch by source and by group.
                                        splits = {};
-                                       maxQueryLength = mw.config.get( 'wgResourceLoaderMaxQueryLength', -1 );
+                                       maxQueryLength = mw.config.get( 'wgResourceLoaderMaxQueryLength', 2000 );
 
                                        // Appends a list of modules from the queue to the batch
                                        for ( q = 0; q < queue.length; q += 1 ) {
                                                                        moduleMap = {};
                                                                        async = true;
                                                                        l = currReqBaseLength + 9;
+                                                                       mw.track( 'resourceloader.splitRequest', { maxQueryLength: maxQueryLength } );
                                                                }
                                                                if ( !hasOwn.call( moduleMap, prefix ) ) {
                                                                        moduleMap[prefix] = [];