Fix Bug #29231: PhpHttpRequest doesn't support HTTPS
authorMark A. Hershberger <mah@users.mediawiki.org>
Wed, 1 Jun 2011 18:57:33 +0000 (18:57 +0000)
committerMark A. Hershberger <mah@users.mediawiki.org>
Wed, 1 Jun 2011 18:57:33 +0000 (18:57 +0000)
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
tests/phpunit/includes/HttpTest.php

index 56f864c..b36011e 100644 (file)
@@ -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'] );
                }
 
index f668310..4201399 100644 (file)
@@ -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/' ),