// Stream the requested file
wfDebugLog( 'img_auth', "Streaming `{$filename}`" );
-wfStreamFile( $filename );
+wfStreamFile( $filename, array( 'Cache-Control: private', 'Vary: Cookie' ) );
wfLogProfilingData();
/**
*/
function wfForbidden() {
header( 'HTTP/1.0 403 Forbidden' );
+ header( 'Vary: Cookie' );
header( 'Content-Type: text/html; charset=utf-8' );
- echo <<<END
+ echo <<<ENDS
<html>
<body>
<h1>Access Denied</h1>
<p>You need to log in to access files on this server.</p>
</body>
</html>
-END;
+ENDS;
wfLogProfilingData();
exit();
-}
\ No newline at end of file
+}
/** */
/** */
-function wfStreamFile( $fname ) {
+function wfStreamFile( $fname, $headers = array() ) {
$stat = @stat( $fname );
if ( !$stat ) {
header( 'HTTP/1.0 404 Not Found' );
global $wgContLanguageCode;
header( "Content-Disposition: inline;filename*=utf-8'$wgContLanguageCode'" . urlencode( basename( $fname ) ) );
+ foreach ( $headers as $header ) {
+ header( $header );
+ }
+
if ( !empty( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ) ) {
$modsince = preg_replace( '/;.*$/', '', $_SERVER['HTTP_IF_MODIFIED_SINCE'] );
$sinceTime = strtotime( $modsince );