http://www.mediawiki.org/wiki/Special:Code/MediaWiki/82908

Revision: 82908
Author:   jeroendedauw
Date:     2011-02-27 20:48:52 +0000 (Sun, 27 Feb 2011)
Log Message:
-----------
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: trunk/phase3/includes/HttpFunctions.php
===================================================================
--- trunk/phase3/includes/HttpFunctions.php     2011-02-27 20:16:58 UTC (rev 
82907)
+++ trunk/phase3/includes/HttpFunctions.php     2011-02-27 20:48:52 UTC (rev 
82908)
@@ -139,6 +139,8 @@
  * php's HTTP extension.
  */
 class MWHttpRequest {
+       const SUPPORTS_FILE_POSTS = false;
+       
        protected $content;
        protected $timeout = 'default';
        protected $headersOnly = null;
@@ -344,10 +346,6 @@
                        $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 @@
  * 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 @@
        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', '<' 
);


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to