X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2FStreamFile.php;h=eb7266ef85fe50e123449092c6d24fc416847a21;hb=52c87634f84f25f34a6ef8d881839a876a5ef13d;hp=07f374d35e68630e9b3ec0d33f6abd2a73904db4;hpb=9411d91b49b50de73f878d7e677d5209030d751a;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/StreamFile.php b/includes/StreamFile.php index 07f374d35e..eb7266ef85 100644 --- a/includes/StreamFile.php +++ b/includes/StreamFile.php @@ -1,8 +1,9 @@ @@ -13,145 +14,51 @@ does not.

return; } + header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s', $stat['mtime'] ) . ' GMT' ); + + if ( !empty( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ) ) { + $modsince = preg_replace( '/;.*$/', '', $_SERVER['HTTP_IF_MODIFIED_SINCE'] ); + $sinceTime = strtotime( $modsince ); + if ( $stat['mtime'] <= $sinceTime ) { + header( "HTTP/1.0 304 Not Modified" ); + return; + } + } + + header( 'Content-Length: ' . $stat['size'] ); $type = wfGetType( $fname ); - if ( $type ) { + if ( $type and $type!="unknown/unknown") { header("Content-type: $type"); } else { header('Content-type: application/x-wiki'); } - header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s', $stat['mtime'] ) ); - header( "Cache-Control: s-maxage=$wgSquidMaxage, must-revalidate, max-age=0" ); + readfile( $fname ); - exit; } +/** */ function wfGetType( $filename ) { - # There's probably a better way to do this - $types = <<guessMimeType($filename); //full fancy mime detection } - return false; } ?>