From 370e83bb0dfd0c70de268c93bf07ad5ee0897192 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Fri, 15 Aug 2008 01:29:47 +0200 Subject: Update auf 1.13.0 --- includes/OutputHandler.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'includes/OutputHandler.php') diff --git a/includes/OutputHandler.php b/includes/OutputHandler.php index 107553fc..2b3e9fae 100644 --- a/includes/OutputHandler.php +++ b/includes/OutputHandler.php @@ -48,7 +48,7 @@ function wfRequestExtension() { // Can't get the path from the server? :( return ''; } - + $period = strrpos( $path, '.' ); if( $period !== false ) { return strtolower( substr( $path, $period ) ); @@ -64,7 +64,7 @@ function wfGzipHandler( $s ) { if( !function_exists( 'gzencode' ) || headers_sent() ) { return $s; } - + $ext = wfRequestExtension(); if( $ext == '.gz' || $ext == '.tgz' ) { // Don't do gzip compression if the URL path ends in .gz or .tgz @@ -73,7 +73,7 @@ function wfGzipHandler( $s ) { // Bad Safari! Bad! return $s; } - + if( isset( $_SERVER['HTTP_ACCEPT_ENCODING'] ) ) { $tokens = preg_split( '/[,; ]/', $_SERVER['HTTP_ACCEPT_ENCODING'] ); if ( in_array( 'gzip', $tokens ) ) { @@ -81,7 +81,7 @@ function wfGzipHandler( $s ) { $s = gzencode( $s, 3 ); } } - + // Set vary header if it hasn't been set already $headers = headers_list(); $foundVary = false; @@ -102,7 +102,12 @@ function wfGzipHandler( $s ) { * Mangle flash policy tags which open up the site to XSS attacks. */ function wfMangleFlashPolicy( $s ) { - return preg_replace( '/\<\s*cross-domain-policy\s*\>/i', '', $s ); + # Avoid weird excessive memory usage in PCRE on big articles + if ( preg_match( '/\<\s*cross-domain-policy\s*\>/i', $s ) ) { + return preg_replace( '/\<\s*cross-domain-policy\s*\>/i', '', $s ); + } else { + return $s; + } } /** @@ -170,4 +175,3 @@ EOT; $out .= ''; return $out; } - -- cgit v1.2.2