From b57ed467998c7331931223c48a9239204661ba0a Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Tue, 13 Jun 2006 23:54:08 +0000 Subject: [PATCH] * Return correct content-type header with 304 responses for StreamFile; it confuses Safari if you let it return "text/html". --- RELEASE-NOTES | 2 ++ includes/StreamFile.php | 14 +++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 0b003da7f9..688c9e12bb 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -489,6 +489,8 @@ Some default configuration options have changed: * (bug 2700) Nice things like link completion and signatures now work in tags. * Cancel output buffering in StreamFile; when used inside gzip buffering this could cause funny timeout behavior as the Content-Length was wrong. +* Return correct content-type header with 304 responses for StreamFile; + it confuses Safari if you let it return "text/html". == Compatibility == diff --git a/includes/StreamFile.php b/includes/StreamFile.php index 4b659deac2..8c3b5372a7 100644 --- a/includes/StreamFile.php +++ b/includes/StreamFile.php @@ -24,6 +24,13 @@ does not.

} } + $type = wfGetType( $fname ); + if ( $type and $type!="unknown/unknown") { + header("Content-type: $type"); + } else { + header('Content-type: application/x-wiki'); + } + if ( !empty( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ) ) { $modsince = preg_replace( '/;.*$/', '', $_SERVER['HTTP_IF_MODIFIED_SINCE'] ); $sinceTime = strtotime( $modsince ); @@ -35,13 +42,6 @@ does not.

header( 'Content-Length: ' . $stat['size'] ); - $type = wfGetType( $fname ); - if ( $type and $type!="unknown/unknown") { - header("Content-type: $type"); - } else { - header('Content-type: application/x-wiki'); - } - readfile( $fname ); } -- 2.20.1