From: Trevor Parscal Date: Sat, 4 Sep 2010 08:38:45 +0000 (+0000) Subject: Fix a bug in the resource loader causing it to return no Content-Type header for... X-Git-Tag: 1.31.0-rc.0~35168 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22articles%22%2C%22id_article=%24id_article%22%29%20.%20%22?a=commitdiff_plain;h=0aa8869150e86b18ed33facc7143c3f8f4c4330b;p=lhc%2Fweb%2Fwiklou.git Fix a bug in the resource loader causing it to return no Content-Type header for 304s. Firefox doesn't care but Chrome seems to, so we always set the right Content-Type --- diff --git a/includes/ResourceLoader.php b/includes/ResourceLoader.php index b59d6019ca..5fad05a6d2 100644 --- a/includes/ResourceLoader.php +++ b/includes/ResourceLoader.php @@ -254,6 +254,13 @@ class ResourceLoader { $maxage = min( $maxage, self::$modules[$name]->getClientMaxage() ); $smaxage = min( $smaxage, self::$modules[$name]->getServerMaxage() ); } + + // Output headers + if ( $context->getOnly() === 'styles' ) { + header( 'Content-Type: text/css' ); + } else { + header( 'Content-Type: text/javascript' ); + } header( 'Last-Modified: ' . wfTimestamp( TS_RFC2822, $mtime ) ); $expires = wfTimestamp( TS_RFC2822, min( $maxage, $smaxage ) + time() ); header( "Cache-Control: public, maxage=$maxage, s-maxage=$smaxage" ); @@ -322,10 +329,7 @@ class ResourceLoader { } } // Output the appropriate header - if ( $context->getOnly() === 'styles' ) { - header( 'Content-Type: text/css' ); - } else { - header( 'Content-Type: text/javascript' ); + if ( $context->getOnly() !== 'styles' ) { if ( $context->getDebug() ) { ob_end_flush(); } else {