$GLOBALS['xmlrpc_internalencoding']='ISO-8859-1';\r
\r
$GLOBALS['xmlrpcName']='XML-RPC for PHP';\r
- $GLOBALS['xmlrpcVersion']='3.0.0';\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
* @param integer $port the port the server is listening on, defaults to 80 or 443 depending on protocol used\r
* @param string $method the http protocol variant: defaults to 'http', 'https' and 'http11' can be used if CURL is installed\r
*/\r
- function xmlrpc_client($path, $server='', $port='', $method='')\r
+ function __construct($path, $server='', $port='', $method='')\r
{\r
// allow user to specify all params in $path\r
if($server == '' and $port == '' and $method == '')\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
* NB: as of now we do not do it, since it might be either an xmlrpcval or a plain\r
* php val, or a complete xml chunk, depending on usage of xmlrpc_client::send() inside which creator is called...\r
*/\r
- function xmlrpcresp($val, $fcode = 0, $fstr = '', $valtyp='')\r
+ function __construct($val, $fcode = 0, $fstr = '', $valtyp='')\r
{\r
if($fcode != 0)\r
{\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
* @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
*/\r
- function xmlrpcmsg($meth, $pars=0)\r
+ function __construct($meth, $pars=0)\r
{\r
$this->methodname=$meth;\r
if(is_array($pars) && count($pars)>0)\r
}\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
{\r
if ($tag != 'value')\r
{\r
- $GLOBALS['_xh']['cookies'][$cookiename][$tag] = $val;\r
+ $GLOBALS['_xh']['cookies'][$cookiename][$tag] = $val;\r
}\r
}\r
}\r
* @param mixed $val\r
* @param string $type any valid xmlrpc type name (lowercase). If null, 'string' is assumed\r
*/\r
- function xmlrpcval($val=-1, $type='')\r
+ function __construct($val=-1, $type='')\r
{\r
/// @todo: optimization creep - do not call addXX, do it all inline.\r
/// downside: booleans will not be coerced anymore\r
}\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
}\r
}\r
\r
- $parser = xml_parser_create();\r
+ $parser = xml_parser_create();\r
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, true);\r
// What if internal encoding is not in one of the 3 allowed?\r
// we use the broadest one, ie. utf8!\r
\r
// test if encoding is specified in the xml declaration\r
// Details:\r
- // SPACE: (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+\r
+ // SPACE: (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+\r
// EQ: SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]*\r
if (preg_match('/^<\?xml\s+version\s*=\s*' . "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))" .\r
'\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/",\r