More testsuite fixes
[plcapi.git] / lib / xmlrpc.inc
index 41dae8b..7123184 100644 (file)
        $GLOBALS['xmlrpc_internalencoding']='ISO-8859-1';\r
 \r
        $GLOBALS['xmlrpcName']='XML-RPC for PHP';\r
-       $GLOBALS['xmlrpcVersion']='3.0.1';\r
+       $GLOBALS['xmlrpcVersion']='3.1.0';\r
 \r
        // let user errors start at 800\r
        $GLOBALS['xmlrpcerruser']=800;\r
                var $keypass='';\r
                var $verifypeer=true;\r
                var $verifyhost=1;\r
+               var $sslversion=0; // corresponds to CURL_SSLVERSION_DEFAULT\r
                var $no_multicall=false;\r
                var $proxy='';\r
                var $proxyport=0;\r
                */\r
                var $user_agent;\r
 \r
-               /**\r
-               * @deprecated\r
-               */\r
-               function xmlrpc_client($path, $server='', $port='', $method='')\r
-               {\r
-                       self::__construct($path, $server, $port, $method);\r
-               }\r
-\r
                /**\r
                * @param string $path either the complete server URL or the PATH part of the xmlrc server URL, e.g. /xmlrpc/server.php\r
                * @param string $server the server name / ip address\r
                        $this->user_agent = $GLOBALS['xmlrpcName'] . ' ' . $GLOBALS['xmlrpcVersion'];\r
                }\r
 \r
+               /**\r
+               * @deprecated\r
+               */\r
+               function xmlrpc_client($path, $server='', $port='', $method='')\r
+               {\r
+                       self::__construct($path, $server, $port, $method);\r
+               }\r
+\r
                /**\r
                * Enables/disables the echoing to screen of the xmlrpc responses received\r
                * @param integer $in values 0, 1 and 2 are supported (2 = echo sent msg too, before received response)\r
                        $this->verifyhost = $i;\r
                }\r
 \r
+               /**\r
+               * Set attributes for SSL communication: SSL version to use. Best left at 0 (default value ): let cURL decide\r
+               *\r
+               * @param int $i\r
+               */\r
+               public function setSSLVersion($i)\r
+               {\r
+                       $this->sslversion = $i;\r
+               }\r
+\r
                /**\r
                * Set proxy info\r
                * @param string $proxyhost\r
                                        $this->proxy_authtype,\r
                                        $this->keepalive,\r
                                        $this->key,\r
-                                       $this->keypass\r
+                                       $this->keypass,\r
+                                       $this->sslversion\r
                                );\r
                        }\r
                        elseif($method == 'http11')\r
                function &sendPayloadHTTPS($msg, $server, $port, $timeout=0, $username='',\r
                        $password='', $authtype=1, $cert='',$certpass='', $cacert='', $cacertdir='',\r
                        $proxyhost='', $proxyport=0, $proxyusername='', $proxypassword='', $proxyauthtype=1,\r
-                       $keepalive=false, $key='', $keypass='')\r
+                       $keepalive=false, $key='', $keypass='', $sslVersion = 0)\r
                {\r
                        $r =& $this->sendPayloadCURL($msg, $server, $port, $timeout, $username,\r
                                $password, $authtype, $cert, $certpass, $cacert, $cacertdir, $proxyhost, $proxyport,\r
-                               $proxyusername, $proxypassword, $proxyauthtype, 'https', $keepalive, $key, $keypass);\r
+                               $proxyusername, $proxypassword, $proxyauthtype, 'https', $keepalive, $key, $keypass, $sslVersion);\r
                        return $r;\r
                }\r
 \r
                function &sendPayloadCURL($msg, $server, $port, $timeout=0, $username='',\r
                        $password='', $authtype=1, $cert='', $certpass='', $cacert='', $cacertdir='',\r
                        $proxyhost='', $proxyport=0, $proxyusername='', $proxypassword='', $proxyauthtype=1, $method='https',\r
-                       $keepalive=false, $key='', $keypass='')\r
+                       $keepalive=false, $key='', $keypass='', $sslVersion = 0)\r
                {\r
                        if(!function_exists('curl_init'))\r
                        {\r
                                }\r
                                // whether to verify cert's common name (CN); 0 for no, 1 to verify that it exists, and 2 to verify that it matches the hostname used\r
                                curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, $this->verifyhost);\r
+                               // allow usage of different SSL versions\r
+                               curl_setopt($curl, CURLOPT_SSLVERSION, $sslVersion);\r
                        }\r
 \r
                        // proxy info\r
                var $content_type = 'text/xml';\r
                var $raw_data = '';\r
 \r
-               /**\r
-               * @deprecated\r
-               */\r
-               function xmlrpcresp($val, $fcode = 0, $fstr = '', $valtyp='')\r
-               {\r
-                       self::__construct($val, $fcode, $fstr, $valtyp);\r
-               }\r
-\r
                /**\r
                * @param mixed $val either an xmlrpcval obj, a php value or the xml serialization of an xmlrpcval (a string)\r
                * @param integer $fcode set it to anything but 0 to create an error response\r
                        }\r
                }\r
 \r
+               /**\r
+               * @deprecated\r
+               */\r
+               function xmlrpcresp($val, $fcode = 0, $fstr = '', $valtyp='')\r
+               {\r
+                       self::__construct($val, $fcode, $fstr, $valtyp);\r
+               }\r
+\r
                /**\r
                * Returns the error code of the response.\r
                * @return integer the error code of this response (0 for not-error responses)\r
@@ -2135,14 +2149,6 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha
                var $debug=0;\r
                var $content_type = 'text/xml';\r
 \r
-               /**\r
-               * @deprecated\r
-               */\r
-               function xmlrpcmsg($meth, $pars=0)\r
-               {\r
-                       self::__construct($meth, $pars);\r
-               }\r
-\r
                /**\r
                * @param string $meth the name of the method to invoke\r
                * @param array $pars array of parameters to be passed to the method (xmlrpcval objects)\r
@@ -2159,6 +2165,14 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha
                        }\r
                }\r
 \r
+                               /**\r
+               * @deprecated\r
+               */\r
+               function xmlrpcmsg($meth, $pars=0)\r
+               {\r
+                       self::__construct($meth, $pars);\r
+               }\r
+\r
                /**\r
                * @access private\r
                */\r
@@ -2775,14 +2789,6 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha
                var $mytype=0;\r
                var $_php_class=null;\r
 \r
-               /**\r
-               * @deprecated\r
-               */\r
-               function xmlrpcval($val=-1, $type='')\r
-               {\r
-                       self::__construct($val, $type);\r
-               }\r
-\r
                /**\r
                * @param mixed $val\r
                * @param string $type any valid xmlrpc type name (lowercase). If null, 'string' is assumed\r
@@ -2841,6 +2847,14 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha
                        }\r
                }\r
 \r
+               /**\r
+               * @deprecated\r
+               */\r
+               function xmlrpcval($val=-1, $type='')\r
+               {\r
+                       self::__construct($val, $type);\r
+               }\r
+\r
                /**\r
                * Add a single php value to an (unitialized) xmlrpcval\r
                * @param mixed $val\r