r96562 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96561‎ | r96562 | r96563 >
Date:13:48, 8 September 2011
Author:catrope
Status:ok
Tags:
Comment:
Move URL expansion from Http::request() (where it was put in r93820) to MWHttpRequest::__construct(). That should fix bug 30797 (UploadStash barfs on protocol-relative URLs)
Modified paths:
  • /trunk/phase3/includes/HttpFunctions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/HttpFunctions.php
@@ -32,7 +32,6 @@
3333 * @return Mixed: (bool)false on failure or a string on success
3434 */
3535 public static function request( $method, $url, $options = array() ) {
36 - $url = wfExpandUrl( $url, PROTO_HTTP );
3736 wfDebug( "HTTP: $method: $url\n" );
3837 $options['method'] = strtoupper( $method );
3938
@@ -178,14 +177,14 @@
179178 public $status;
180179
181180 /**
182 - * @param $url String: url to use
 181+ * @param $url String: url to use. If protocol-relative, will be expanded to an http:// URL
183182 * @param $options Array: (optional) extra params to pass (see Http::request())
184183 */
185184 function __construct( $url, $options = array() ) {
186185 global $wgHTTPTimeout;
187186
188 - $this->url = $url;
189 - $this->parsedUrl = parse_url( $url );
 187+ $this->url = wfExpandUrl( $url, PROTO_HTTP );
 188+ $this->parsedUrl = parse_url( $this->url );
190189
191190 if ( !Http::isValidURI( $this->url ) ) {
192191 $this->status = Status::newFatal( 'http-invalid-url' );

Follow-up revisions

RevisionCommit summaryAuthorDate
r96563Add tests for r96562. HttpTest still has 5 failing test (which is why it's ma...catrope13:49, 8 September 2011
r97263REL1_18 MFT r93626, r96562, r96640, r96978, r97050reedy13:19, 16 September 2011
r972871.17wmf1 MFT r96562, r97177reedy15:12, 16 September 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r93820Some random URL protocol forcing for protocol-relative URLscatrope12:58, 3 August 2011

Status & tagging log