Index: trunk/phase3/includes/resourceloader/ResourceLoader.php |
— | — | @@ -329,14 +329,15 @@ |
330 | 330 | |
331 | 331 | wfProfileIn( __METHOD__.'-getModifiedTime' ); |
332 | 332 | |
| 333 | + $private = false; |
333 | 334 | // To send Last-Modified and support If-Modified-Since, we need to detect |
334 | 335 | // the last modified time |
335 | 336 | $mtime = wfTimestamp( TS_UNIX, $wgCacheEpoch ); |
336 | 337 | foreach ( $modules as $module ) { |
337 | 338 | try { |
338 | | - // Bypass squid cache if the request includes any private modules |
| 339 | + // Bypass Squid and other shared caches if the request includes any private modules |
339 | 340 | if ( $module->getGroup() === 'private' ) { |
340 | | - $smaxage = 0; |
| 341 | + $private = true; |
341 | 342 | } |
342 | 343 | // Calculate maximum modified time |
343 | 344 | $mtime = max( $mtime, $module->getModifiedTime( $context ) ); |
— | — | @@ -355,10 +356,18 @@ |
356 | 357 | } |
357 | 358 | header( 'Last-Modified: ' . wfTimestamp( TS_RFC2822, $mtime ) ); |
358 | 359 | if ( $context->getDebug() ) { |
359 | | - header( 'Cache-Control: must-revalidate' ); |
| 360 | + // Do not cache debug responses |
| 361 | + header( 'Cache-Control: private, no-cache, must-revalidate' ); |
| 362 | + header( 'Pragma: no-cache' ); |
360 | 363 | } else { |
361 | | - header( "Cache-Control: public, max-age=$maxage, s-maxage=$smaxage" ); |
362 | | - header( 'Expires: ' . wfTimestamp( TS_RFC2822, min( $maxage, $smaxage ) + time() ) ); |
| 364 | + if ( $private ) { |
| 365 | + header( "Cache-Control: private, max-age=$maxage" ); |
| 366 | + $exp = $maxage; |
| 367 | + } else { |
| 368 | + header( "Cache-Control: public, max-age=$maxage, s-maxage=$smaxage" ); |
| 369 | + $exp = min( $maxage, $smaxage ); |
| 370 | + } |
| 371 | + header( 'Expires: ' . wfTimestamp( TS_RFC2822, $exp + time() ) ); |
363 | 372 | } |
364 | 373 | |
365 | 374 | // If there's an If-Modified-Since header, respond with a 304 appropriately |