X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FWebRequest.php;h=c99e4846db26522f44569edad536c7ac38a07cdb;hb=ca8cb1c90edd1bd2584fd5be0dce787cc6b62bc4;hp=6bdcc8718629ccd8ed7a55e5da74cdab545cc971;hpb=a07ea9326e540e7b7b54685a0dff796cd9e9572f;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/WebRequest.php b/includes/WebRequest.php index 6bdcc87186..c99e4846db 100644 --- a/includes/WebRequest.php +++ b/includes/WebRequest.php @@ -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. @@ -691,7 +695,7 @@ class WebRequest { // This shouldn't happen! throw new MWException( "Web server doesn't provide either " . "REQUEST_URI, HTTP_X_ORIGINAL_URL or SCRIPT_NAME. Report details " . - "of your web server configuration to http://bugzilla.wikimedia.org/" ); + "of your web server configuration to https://phabricator.wikimedia.org/" ); } // User-agents should not send a fragment with the URI, but // if they do, and the web server passes it on to us, we @@ -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;