* (bug 13273) "Categories:" message at the bottom of the page shouldn't have
hardcoded colon, use new 'colon-separator' message instead
* Parse MediaWiki message translations with a correct language setting on preview
+* (bug 13281) Treat X-Forwarde-For, Client-ip and User-Agent headers as
+ case-insensitive names.
=== API changes in 1.13 ===
function wfGetForwardedFor() {
if( function_exists( 'apache_request_headers' ) ) {
// More reliable than $_SERVER due to case and -/_ folding
- $set = apache_request_headers();
- $index = 'X-Forwarded-For';
- $index2 = 'Client-ip';
+ $set = array ();
+ foreach ( apache_request_headers() as $tempName => $tempValue ) {
+ $set[ strtoupper( $tempName ) ] = $tempValue;
+ }
+ $index = strtoupper ( 'X-Forwarded-For' );
+ $index2 = strtoupper ( 'Client-ip' );
} else {
// Subject to spoofing with headers like X_Forwarded_For
$set = $_SERVER;
$index = 'HTTP_X_FORWARDED_FOR';
$index2 = 'CLIENT-IP';
}
+
#Try a couple of headers
if( isset( $set[$index] ) ) {
return $set[$index];
function wfGetAgent() {
if( function_exists( 'apache_request_headers' ) ) {
// More reliable than $_SERVER due to case and -/_ folding
- $set = apache_request_headers();
- $index = 'User-Agent';
+ $set = array ();
+ foreach ( apache_request_headers() as $tempName => $tempValue ) {
+ $set[ strtoupper( $tempName ) ] = $tempValue;
+ }
+ $index = strtoupper ( 'User-Agent' );
} else {
// Subject to spoofing with headers like X_Forwarded_For
$set = $_SERVER;