From: Jeroen De Dauw Date: Sun, 27 Feb 2011 20:48:52 +0000 (+0000) Subject: Moved stuff so the cURL class can be used to post files and added constants so you... X-Git-Tag: 1.31.0-rc.0~31735 X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=commitdiff_plain;h=0e0f81cdae5750f9819af42e65100e14536155b3;p=lhc%2Fweb%2Fwiklou.git Moved stuff so the cURL class can be used to post files and added constants so you can check if the class allows for file posting --- diff --git a/includes/HttpFunctions.php b/includes/HttpFunctions.php index 924f5432cb..0197402af3 100644 --- a/includes/HttpFunctions.php +++ b/includes/HttpFunctions.php @@ -139,6 +139,8 @@ class Http { * php's HTTP extension. */ class MWHttpRequest { + const SUPPORTS_FILE_POSTS = false; + protected $content; protected $timeout = 'default'; protected $headersOnly = null; @@ -344,10 +346,6 @@ class MWHttpRequest { $this->headersOnly = true; } - if ( is_array( $this->postData ) ) { - $this->postData = wfArrayToCGI( $this->postData ); - } - if ( is_object( $wgTitle ) && !isset( $this->reqHeaders['Referer'] ) ) { $this->setReferer( $wgTitle->getFullURL() ); } @@ -801,6 +799,8 @@ class CookieJar { * MWHttpRequest implemented using internal curl compiled into PHP */ class CurlHttpRequest extends MWHttpRequest { + const SUPPORTS_FILE_POSTS = true; + static $curlMessageMap = array( 6 => 'http-host-unreachable', 28 => 'http-timed-out' @@ -925,6 +925,10 @@ class PhpHttpRequest extends MWHttpRequest { public function execute() { parent::execute(); + if ( is_array( $this->postData ) ) { + $this->postData = wfArrayToCGI( $this->postData ); + } + // At least on Centos 4.8 with PHP 5.1.6, using max_redirects to follow redirects // causes a segfault $manuallyRedirect = version_compare( phpversion(), '5.1.7', '<' );