From 0e0f81cdae5750f9819af42e65100e14536155b3 Mon Sep 17 00:00:00 2001 From: Jeroen De Dauw Date: Sun, 27 Feb 2011 20:48:52 +0000 Subject: [PATCH] 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 --- includes/HttpFunctions.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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', '<' ); -- 2.20.1