r112056 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112055‎ | r112056 | r112057 >
Date:22:40, 21 February 2012
Author:awjrichards
Status:resolved (Comments)
Tags:
Comment:
Added forward-compatibility with potential new wfIsConfiguredProxy function (introduced r111788) - this checks an IP against the list of configured squid proxies. This is preferred over wfIsTrustedProxy since wfIsTrustedProxy also runs a hook that gets used by an extension on the WMF cluster to check the IP against trusted open proxies as well as the configured squid proxies, which is not our desired behavior.
Modified paths:
  • /trunk/extensions/MobileFrontend/MobileFrontend.body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MobileFrontend/MobileFrontend.body.php
@@ -725,7 +725,18 @@
726726 } else {
727727 $ip = null;
728728 }
729 - if ( wfIsTrustedProxy ( $ip )) {
 729+
 730+ /**
 731+ * Compatibility with potentially new function wfIsConfiguredProxy()
 732+ * wfIsConfiguredProxy() checks an IP against the list of configured
 733+ * Squid servers and currently only exists in trunk.
 734+ * wfIsTrustedProxy() does the same, but also exposes a hook that is
 735+ * used on the WMF cluster to check and see if an IP address matches
 736+ * against a list of approved open proxies, which we don't actually
 737+ * care about.
 738+ */
 739+ $trustedProxyCheckFunction = ( function_exists( 'wfIsConfiguredProxy' )) ? 'wfIsConfiguredProxy' : 'wfIsTrustedProxy';
 740+ if ( $trustedProxyCheckFunction( $ip )) {
730741 $wgRequest->response()->header( 'Cache-Control: no-cache, must-revalidate' );
731742 $wgRequest->response()->header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' );
732743 $wgRequest->response()->header( 'Pragma: no-cache' );

Follow-up revisions

RevisionCommit summaryAuthorDate
r112182Followup r112056 - fixing spacing to conform to coding conventionsawjrichards02:04, 23 February 2012

Comments

#Comment by Awjrichards (talk | contribs)   22:42, 21 February 2012

Er check-in comment should read "Added forward-compatibility with potential new wfIsConfiguredProxy function (introduced r112050)" instead.

#Comment by Preilly (talk | contribs)   17:05, 22 February 2012

You are missing a space around "))" after 'wfIsConfiguredProxy'.

#Comment by Awjrichards (talk | contribs)   02:05, 23 February 2012

Fixed in r112182.

Status & tagging log