r82908 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r82907‎ | r82908 | r82909 >
Date:20:48, 27 February 2011
Author:jeroendedauw
Status:ok
Tags:
Comment:
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
Modified paths:
  • /trunk/phase3/includes/HttpFunctions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/HttpFunctions.php
@@ -139,6 +139,8 @@
140140 * php's HTTP extension.
141141 */
142142 class MWHttpRequest {
 143+ const SUPPORTS_FILE_POSTS = false;
 144+
143145 protected $content;
144146 protected $timeout = 'default';
145147 protected $headersOnly = null;
@@ -344,10 +346,6 @@
345347 $this->headersOnly = true;
346348 }
347349
348 - if ( is_array( $this->postData ) ) {
349 - $this->postData = wfArrayToCGI( $this->postData );
350 - }
351 -
352350 if ( is_object( $wgTitle ) && !isset( $this->reqHeaders['Referer'] ) ) {
353351 $this->setReferer( $wgTitle->getFullURL() );
354352 }
@@ -801,6 +799,8 @@
802800 * MWHttpRequest implemented using internal curl compiled into PHP
803801 */
804802 class CurlHttpRequest extends MWHttpRequest {
 803+ const SUPPORTS_FILE_POSTS = true;
 804+
805805 static $curlMessageMap = array(
806806 6 => 'http-host-unreachable',
807807 28 => 'http-timed-out'
@@ -925,6 +925,10 @@
926926 public function execute() {
927927 parent::execute();
928928
 929+ if ( is_array( $this->postData ) ) {
 930+ $this->postData = wfArrayToCGI( $this->postData );
 931+ }
 932+
929933 // At least on Centos 4.8 with PHP 5.1.6, using max_redirects to follow redirects
930934 // causes a segfault
931935 $manuallyRedirect = version_compare( phpversion(), '5.1.7', '<' );

Status & tagging log