Fix-up for I2ac604d3c042d
[lhc/web/wiklou.git] / includes / WebRequest.php
index 05e229d..c99e484 100644 (file)
@@ -176,6 +176,8 @@ class WebRequest {
         * @return string
         */
        public static function detectServer() {
+               global $wgAssumeProxiesUseDefaultProtocolPorts;
+
                $proto = self::detectProtocol();
                $stdPort = $proto === 'https' ? 443 : 80;
 
@@ -186,13 +188,15 @@ class WebRequest {
                        if ( !isset( $_SERVER[$varName] ) ) {
                                continue;
                        }
+
                        $parts = IP::splitHostAndPort( $_SERVER[$varName] );
                        if ( !$parts ) {
                                // Invalid, do not use
                                continue;
                        }
+
                        $host = $parts[0];
-                       if ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) ) {
+                       if ( $wgAssumeProxiesUseDefaultProtocolPorts && isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) ) {
                                // Bug 70021: Assume that upstream proxy is running on the default
                                // port based on the protocol. We have no reliable way to determine
                                // the actual port in use upstream.
@@ -774,7 +778,7 @@ class WebRequest {
         *
         * @param int $deflimit Limit to use if no input and the user hasn't set the option.
         * @param string $optionname To specify an option other than rclimit to pull from.
-        * @return array First element is limit, second is offset
+        * @return int[] First element is limit, second is offset
         */
        public function getLimitOffset( $deflimit = 50, $optionname = 'rclimit' ) {
                global $wgUser;