Change default of $wgResourceLoaderMaxQueryLength to 2000

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
This commit is contained in:
Jan Zerebecki 2015-02-26 17:51:13 +01:00
parent 39db7e461b
commit cbce504c3d
2 changed files with 10 additions and 4 deletions

View 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);
}
/**

View file

@ -1537,7 +1537,7 @@
};
// 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 ) {
@ -1674,6 +1674,7 @@
moduleMap = {};
async = true;
l = currReqBaseLength + 9;
mw.track( 'resourceloader.splitRequest', { maxQueryLength: maxQueryLength } );
}
if ( !hasOwn.call( moduleMap, prefix ) ) {
moduleMap[prefix] = [];