From 623083aa78143cac917fd430ff294d5285ecb9b9 Mon Sep 17 00:00:00 2001 From: "Mark A. Hershberger" Date: Wed, 1 Jun 2011 18:57:33 +0000 Subject: [PATCH] Fix Bug #29231: PhpHttpRequest doesn't support HTTPS MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Tested fix with PHPUnit Tests that aren't currently executed by CruiseControl b/c they're marked “broken” till someone comes up with some reasonable unit tests that will work for everyone. --- includes/HttpFunctions.php | 4 +++- tests/phpunit/includes/HttpTest.php | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/includes/HttpFunctions.php b/includes/HttpFunctions.php index 56f864c3a7..b36011e94c 100644 --- a/includes/HttpFunctions.php +++ b/includes/HttpFunctions.php @@ -713,7 +713,9 @@ class PhpHttpRequest extends MWHttpRequest { $this->postData = wfArrayToCGI( $this->postData ); } - if ( $this->parsedUrl['scheme'] != 'http' ) { + if ( $this->parsedUrl['scheme'] != 'http' && + $this->parsedUrl['scheme'] != 'ftp' && + $this->parsedUrl['scheme'] != 'https' ) { $this->status->fatal( 'http-invalid-scheme', $this->parsedUrl['scheme'] ); } diff --git a/tests/phpunit/includes/HttpTest.php b/tests/phpunit/includes/HttpTest.php index f668310dc8..4201399d07 100644 --- a/tests/phpunit/includes/HttpTest.php +++ b/tests/phpunit/includes/HttpTest.php @@ -17,7 +17,9 @@ class HttpTest extends MediaWikiTestCase { static $has_proxy = false; static $proxy = "http://hulk:8080/"; var $test_geturl = array( + "ftp://ftp.kernel.org/", "http://www.example.com/", + "https://secure.wikimedia.org/", "http://pecl.php.net/feeds/pkg_apc.rss", "http://toolserver.org/~jan/poll/dev/main.php?page=wiki_output&id=3", "http://meta.wikimedia.org/w/index.php?title=Interwiki_map&action=raw", @@ -540,7 +542,7 @@ class HttpTest extends MediaWikiTestCase { return array( array( false, '¿non sens before!! http://a', 'Allow anything before URI' ), - # (ftp|http|https) - only three schemes allowed + # (ftp|http|https) - only three schemes allowed array( true, 'http://www.example.org/' ), array( true, 'https://www.example.org/' ), array( true, 'ftp://www.example.org/' ), -- 2.20.1