From: awjrichards Date: Sun, 11 May 2014 12:24:31 +0000 (+0200) Subject: Make HTTPS port configurable X-Git-Tag: 1.31.0-rc.0~15602^2 X-Git-Url: http://git.cyclocoop.org/%22.htmlspecialchars%28%24url_syndic%29.%22?a=commitdiff_plain;h=86f68d31d32c1796ee1699421a6c06df824253cc;p=lhc%2Fweb%2Fwiklou.git Make HTTPS port configurable Introduces wgHttpsPort configuration variable and makes use of it when appropriate in wfExpandUrl() Bug: 65184 Change-Id: I325ee0ff7be16de2a964fb7d8654b88cbd5fe239 --- diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 5d35c4237a..d18253b657 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -7076,6 +7076,14 @@ $wgCompiledFiles = array(); */ $wgPagePropsHaveSortkey = true; +/** + * Port where you have HTTPS running + * Supports HTTPS on non-standard ports + * @see bug 65184 + * @since 1.24 + */ +$wgHttpsPort = 443; + /** * For really cool vim folding this needs to be at the end: * vim: foldmarker=@{,@} foldmethod=marker diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index d94d2f13f5..bd010437a6 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -497,7 +497,8 @@ function wfAppendQuery( $url, $query ) { * no valid URL can be constructed */ function wfExpandUrl( $url, $defaultProto = PROTO_CURRENT ) { - global $wgServer, $wgCanonicalServer, $wgInternalServer, $wgRequest; + global $wgServer, $wgCanonicalServer, $wgInternalServer, $wgRequest, + $wgHttpsPort; if ( $defaultProto === PROTO_CANONICAL ) { $serverUrl = $wgCanonicalServer; } elseif ( $defaultProto === PROTO_INTERNAL && $wgInternalServer !== false ) { @@ -536,6 +537,13 @@ function wfExpandUrl( $url, $defaultProto = PROTO_CURRENT ) { } $bits = wfParseUrl( $url ); + + // ensure proper port for HTTPS arrives in URL + // https://bugzilla.wikimedia.org/show_bug.cgi?id=65184 + if ( $defaultProto === PROTO_HTTPS && $wgHttpsPort != 443 ) { + $bits['port'] = $wgHttpsPort; + } + if ( $bits && isset( $bits['path'] ) ) { $bits['path'] = wfRemoveDotSegments( $bits['path'] ); return wfAssembleUrl( $bits );