Remove non-functional handling of curl_error()
authorChad Horohoe <chadh@wikimedia.org>
Tue, 2 Apr 2013 18:18:43 +0000 (14:18 -0400)
committerChad Horohoe <chadh@wikimedia.org>
Tue, 2 Apr 2013 18:18:43 +0000 (14:18 -0400)
Per the docs, curl_error() returns a full error string, not an int
or string of an int. Just remove that and pass the error back up.

Change-Id: I7434bb2abda056fdee4d670c192b304c0cdf24f7

includes/HttpFunctions.php
languages/messages/MessagesEn.php
maintenance/language/messages.inc

index 4730a97..285cdac 100644 (file)
@@ -696,11 +696,6 @@ class MWHttpRequest {
 class CurlHttpRequest extends MWHttpRequest {
        const SUPPORTS_FILE_POSTS = true;
 
-       static $curlMessageMap = array(
-               6 => 'http-host-unreachable',
-               28 => 'http-timed-out'
-       );
-
        protected $curlOptions = array();
        protected $headerText = "";
 
@@ -780,13 +775,7 @@ class CurlHttpRequest extends MWHttpRequest {
                }
 
                if ( false === curl_exec( $curlHandle ) ) {
-                       $code = curl_error( $curlHandle );
-
-                       if ( isset( self::$curlMessageMap[$code] ) ) {
-                               $this->status->fatal( self::$curlMessageMap[$code] );
-                       } else {
-                               $this->status->fatal( 'http-curl-error', curl_error( $curlHandle ) );
-                       }
+                       $this->status->fatal( 'http-curl-error', curl_error( $curlHandle ) );
                } else {
                        $this->headerList = explode( "\r\n", $this->headerText );
                }
index 44b6cc9..8365dcb 100644 (file)
@@ -2397,7 +2397,6 @@ For optimal security, img_auth.php is disabled.',
 'http-read-error'       => 'HTTP read error.',
 'http-timed-out'        => 'HTTP request timed out.',
 'http-curl-error'       => 'Error fetching URL: $1',
-'http-host-unreachable' => 'Could not reach URL.',
 'http-bad-status'       => 'There was a problem during the HTTP request: $1 $2',
 
 # Some likely curl errors. More could be added from <http://curl.haxx.se/libcurl/c/libcurl-errors.html>
index 9c883bf..8361b1b 100644 (file)
@@ -1480,7 +1480,6 @@ $wgMessageStructure = array(
                'http-read-error',
                'http-timed-out',
                'http-curl-error',
-               'http-host-unreachable',
                'http-bad-status',
        ),