r111746 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111745‎ | r111746 | r111747 >
Date:12:33, 17 February 2012
Author:preilly
Status:ok (Comments)
Tags:
Comment:
Fix for PHP Fatal error: Call to protected method WebRequest::getRawIP() from MobileFrontend.body.php on line 723
Modified paths:
  • /trunk/extensions/MobileFrontend/MobileFrontend.body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MobileFrontend/MobileFrontend.body.php
@@ -720,7 +720,7 @@
721721 // Fetch the REMOTE_ADDR and check if it's a trusted proxy.
722722 // Is this enough, or should we actually step through the entire
723723 // X-FORWARDED-FOR chain?
724 - $ip = $wgRequest->getRawIP();
 724+ $ip = wfGetIP();
725725 if ( wfIsTrustedProxy ( $ip )) {
726726 $wgRequest->response()->header( 'Cache-Control: no-cache, must-revalidate' );
727727 $wgRequest->response()->header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' );

Follow-up revisions

RevisionCommit summaryAuthorDate
r111777Removed usage of wfGetIP() and now just fetching IP from [REMOTE_ADDR], follo...awjrichards19:28, 17 February 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r111689Removes hardcoded 'wikimedia.org' when checking the proxy server before attem...awjrichards22:12, 16 February 2012

Comments

#Comment by Awjrichards (talk | contribs)   19:28, 17 February 2012

Actually wfGetIP() won't get us what we want here - it'll give us the client's IP address rather than the proxy's (in the event that there is a proxy). Somehow I neglected to notice the fact that getRawIP was protected. Now just pulling the IP from $_SERVER['REMOTE_ADDR'] which should give us the most recently used proxy or the client's ip if no proxies were used in r111777.

Status & tagging log