From fcb782d1533756b71ac5f1218209b88ab47061f7 Mon Sep 17 00:00:00 2001 From: edorfaus Date: Mon, 10 Oct 2011 17:51:51 +0300 Subject: [PATCH] Enable custom HTTP headers to be set for only / without setting them for its children. Without this, specifying e.g. Pragma[/]=cache;0;0 would set Pragma for both / and e.g. /news. --- kernel/classes/ezhttpheader.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kernel/classes/ezhttpheader.php b/kernel/classes/ezhttpheader.php index b403774f36c..57a1fa6ce46 100644 --- a/kernel/classes/ezhttpheader.php +++ b/kernel/classes/ezhttpheader.php @@ -121,7 +121,7 @@ static function headerOverrideArray( $uri ) $headerValue = gmdate( 'D, d M Y H:i:s', time() + $headerValue ) . ' GMT'; } - if ( $depth === null ) + if ( $depth === null || $uriString === $path ) { $headerArray[$header] = $headerValue; } @@ -129,6 +129,10 @@ static function headerOverrideArray( $uri ) { $pathLevel = count( explode( '/', $path ) ); $uriLevel = count( explode( '/', $uriString ) ); + if ( $path == '/' ) + { + $pathLevel--; + } if ( $level === null ) { if ( $uriLevel <= $pathLevel + $depth )