Index: trunk/phase3/includes/User.php |
— | — | @@ -3320,7 +3320,9 @@ |
3321 | 3321 | str_replace( |
3322 | 3322 | '$1', |
3323 | 3323 | "Special:$page/$token", |
3324 | | - $wgArticlePath ) ); |
| 3324 | + $wgArticlePath ), |
| 3325 | + PROT_HTTP |
| 3326 | + ); |
3325 | 3327 | } |
3326 | 3328 | |
3327 | 3329 | /** |
Index: trunk/phase3/includes/parser/CoreParserFunctions.php |
— | — | @@ -723,7 +723,7 @@ |
724 | 724 | // ... and we can |
725 | 725 | if ( $mto && !$mto->isError() ) { |
726 | 726 | // ... change the URL to point to a thumbnail. |
727 | | - $url = wfExpandUrl( $mto->getUrl() ); |
| 727 | + $url = wfExpandUrl( $mto->getUrl(), PROT_RELATIVE ); |
728 | 728 | } |
729 | 729 | } |
730 | 730 | if ( $option == 'nowiki' ) { |
Index: trunk/phase3/includes/filerepo/ForeignAPIRepo.php |
— | — | @@ -370,7 +370,7 @@ |
371 | 371 | public static function httpGet( $url, $timeout = 'default', $options = array() ) { |
372 | 372 | $options['timeout'] = $timeout; |
373 | 373 | /* Http::get */ |
374 | | - $url = wfExpandUrl( $url ); |
| 374 | + $url = wfExpandUrl( $url, PROT_HTTP ); |
375 | 375 | wfDebug( "ForeignAPIRepo: HTTP GET: $url\n" ); |
376 | 376 | $options['method'] = "GET"; |
377 | 377 | |
Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -2818,7 +2818,9 @@ |
2819 | 2819 | $tags[] = Html::element( 'link', array( |
2820 | 2820 | 'rel' => 'EditURI', |
2821 | 2821 | 'type' => 'application/rsd+xml', |
2822 | | - 'href' => wfExpandUrl( wfAppendQuery( wfScript( 'api' ), array( 'action' => 'rsd' ) ) ), |
| 2822 | + // Output a protocol-relative URL here if $wgServer is protocol-relative |
| 2823 | + // Whether RSD accepts relative or protocol-relative URLs is completely undocumented, though |
| 2824 | + 'href' => wfExpandUrl( wfAppendQuery( wfScript( 'api' ), array( 'action' => 'rsd' ) ), PROT_RELATIVE ), |
2823 | 2825 | ) ); |
2824 | 2826 | } |
2825 | 2827 | |
— | — | @@ -2840,7 +2842,7 @@ |
2841 | 2843 | } else { |
2842 | 2844 | $tags[] = Html::element( 'link', array( |
2843 | 2845 | 'rel' => 'canonical', |
2844 | | - 'href' => $this->getTitle()->getFullURL() ) |
| 2846 | + 'href' => wfExpandUrl( $this->getTitle()->getFullURL(), PROTO_HTTP ) ) |
2845 | 2847 | ); |
2846 | 2848 | } |
2847 | 2849 | } |
Index: trunk/phase3/includes/api/ApiRsd.php |
— | — | @@ -48,7 +48,7 @@ |
49 | 49 | $service = array( 'apis' => $this->formatRsdApiList() ); |
50 | 50 | ApiResult::setContent( $service, 'MediaWiki', 'engineName' ); |
51 | 51 | ApiResult::setContent( $service, 'http://www.mediawiki.org/', 'engineLink' ); |
52 | | - ApiResult::setContent( $service, Title::newMainPage()->getFullURL(), 'homePageLink' ); |
| 52 | + ApiResult::setContent( $service, wfExpandUrl( Title::newMainPage()->getFullURL() ), 'homePageLink' ); |
53 | 53 | |
54 | 54 | $result->setIndexedTagName( $service['apis'], 'api' ); |
55 | 55 | |
Index: trunk/phase3/includes/WebRequest.php |
— | — | @@ -595,6 +595,8 @@ |
596 | 596 | * Return the request URI with the canonical service and hostname, path, |
597 | 597 | * and query string. This will be suitable for use as an absolute link |
598 | 598 | * in HTML or other output. |
| 599 | + * |
| 600 | + * NOTE: This will output a protocol-relative URL if $wgServer is protocol-relative |
599 | 601 | * |
600 | 602 | * @return String |
601 | 603 | */ |
Index: trunk/phase3/includes/resourceloader/ResourceLoaderFileModule.php |
— | — | @@ -204,8 +204,9 @@ |
205 | 205 | break; |
206 | 206 | } |
207 | 207 | } |
208 | | - // Make sure the remote base path is a complete valid url |
209 | | - $this->remoteBasePath = wfExpandUrl( $this->remoteBasePath ); |
| 208 | + // Make sure the remote base path is a complete valid URL, |
| 209 | + // but possibly protocol-relative to avoid cache pollution |
| 210 | + $this->remoteBasePath = wfExpandUrl( $this->remoteBasePath, PROT_RELATIVE ); |
210 | 211 | } |
211 | 212 | |
212 | 213 | /** |
Index: trunk/phase3/includes/libs/CSSMin.php |
— | — | @@ -130,15 +130,16 @@ |
131 | 131 | // URLs with absolute paths like /w/index.php need to be expanded |
132 | 132 | // to absolute URLs but otherwise left alone |
133 | 133 | if ( $match['file'][0] !== '' && $match['file'][0][0] === '/' ) { |
134 | | - // Replace the file path with an expanded URL |
135 | | - // ...but only if wfExpandUrl() is even available. This will not be the case if we're running outside of MW |
| 134 | + // Replace the file path with an expanded (possibly protocol-relative) URL |
| 135 | + // ...but only if wfExpandUrl() is even available. |
| 136 | + // This will not be the case if we're running outside of MW |
136 | 137 | $lengthIncrease = 0; |
137 | 138 | if ( function_exists( 'wfExpandUrl' ) ) { |
138 | 139 | $expanded = wfExpandUrl( $match['file'][0] ); |
139 | 140 | $origLength = strlen( $match['file'][0] ); |
140 | 141 | $lengthIncrease = strlen( $expanded ) - $origLength; |
141 | | - $source = substr_replace( $source, wfExpandUrl( $match['file'][0] ), |
142 | | - $match['file'][1], $origLength |
| 142 | + $source = substr_replace( $source, wfExpandUrl( $match['file'][0], PROT_RELATIVE ), |
| 143 | + $match['file'][1], $origLength, |
143 | 144 | ); |
144 | 145 | } |
145 | 146 | // Move the offset to the end of the match, leaving it alone |
Index: trunk/phase3/includes/HttpFunctions.php |
— | — | @@ -14,7 +14,7 @@ |
15 | 15 | * Perform an HTTP request |
16 | 16 | * |
17 | 17 | * @param $method String: HTTP method. Usually GET/POST |
18 | | - * @param $url String: full URL to act on |
| 18 | + * @param $url String: full URL to act on. If protocol-relative, will be expanded to an http:// URL |
19 | 19 | * @param $options Array: options to pass to MWHttpRequest object. |
20 | 20 | * Possible keys for the array: |
21 | 21 | * - timeout Timeout length in seconds |
— | — | @@ -32,7 +32,7 @@ |
33 | 33 | * @return Mixed: (bool)false on failure or a string on success |
34 | 34 | */ |
35 | 35 | public static function request( $method, $url, $options = array() ) { |
36 | | - $url = wfExpandUrl( $url ); |
| 36 | + $url = wfExpandUrl( $url, PROT_HTTP ); |
37 | 37 | wfDebug( "HTTP: $method: $url\n" ); |
38 | 38 | $options['method'] = strtoupper( $method ); |
39 | 39 | |