public $keypass = '';
public $verifypeer = true;
public $verifyhost = 2;
+ public $sslversion = 0; // corresponds to CURL_SSLVERSION_DEFAULT
public $no_multicall = false;
public $proxy = '';
public $proxyport = 0;
$this->verifyhost = $i;
}
+ /**
+ * Set attributes for SSL communication: SSL version to use. Best left at 0 (default value ): let cURL decide
+ *
+ * @param int $i
+ */
+ public function setSSLVersion($i)
+ {
+ $this->sslversion = $i;
+ }
+
/**
* Set proxy info.
*
$this->proxy_authtype,
$this->keepalive,
$this->key,
- $this->keypass
+ $this->keypass,
+ $this->sslversion
);
} elseif ($method == 'http11') {
$r = $this->sendPayloadCURL(
private function sendPayloadHTTPS($msg, $server, $port, $timeout = 0, $username = '',
$password = '', $authtype = 1, $cert = '', $certpass = '', $cacert = '', $cacertdir = '',
$proxyhost = '', $proxyport = 0, $proxyusername = '', $proxypassword = '', $proxyauthtype = 1,
- $keepalive = false, $key = '', $keypass = '')
+ $keepalive = false, $key = '', $keypass = '', $sslversion = 0)
{
$r = $this->sendPayloadCURL($msg, $server, $port, $timeout, $username,
$password, $authtype, $cert, $certpass, $cacert, $cacertdir, $proxyhost, $proxyport,
- $proxyusername, $proxypassword, $proxyauthtype, 'https', $keepalive, $key, $keypass);
+ $proxyusername, $proxypassword, $proxyauthtype, 'https', $keepalive, $key, $keypass, $sslversion);
return $r;
}
private function sendPayloadCURL($msg, $server, $port, $timeout = 0, $username = '',
$password = '', $authtype = 1, $cert = '', $certpass = '', $cacert = '', $cacertdir = '',
$proxyhost = '', $proxyport = 0, $proxyusername = '', $proxypassword = '', $proxyauthtype = 1, $method = 'https',
- $keepalive = false, $key = '', $keypass = '')
+ $keepalive = false, $key = '', $keypass = '', $sslversion = 0)
{
if (!function_exists('curl_init')) {
$this->errstr = 'CURL unavailable on this install';
}
// 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
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, $this->verifyhost);
+ // allow usage of different SSL versions
+ curl_setopt($curl, CURLOPT_SSLVERSION, $sslversion);
}
// proxy info
$this->method = 'https';
$this->client->method = 'https';
$this->client->path = $this->args['HTTPSURI'];
- $this->client->setSSLVerifyPeer( !$this->args['HTTPSIGNOREPEER'] );
- $this->client->setSSLVerifyHost($this->args['HTTPSVERIFYHOST'] );
+ $this->client->setSSLVerifyPeer(!$this->args['HTTPSIGNOREPEER']);
+ $this->client->setSSLVerifyHost($this->args['HTTPSVERIFYHOST']);
+ $this->client->setSSLVersion($this->args['SSLVERSION']);
$this->_runtests();
}
$this->client->method = 'https';
$this->client->setProxy($this->args['PROXYSERVER'], $this->args['PROXYPORT']);
$this->client->path = $this->args['HTTPSURI'];
- $this->client->setSSLVerifyPeer( !$this->args['HTTPSIGNOREPEER'] );
- $this->client->setSSLVerifyHost($this->args['HTTPSVERIFYHOST'] );
+ $this->client->setSSLVerifyPeer(!$this->args['HTTPSIGNOREPEER']);
+ $this->client->setSSLVerifyHost($this->args['HTTPSVERIFYHOST']);
+ $this->client->setSSLVersion($this->args['SSLVERSION']);
$this->_runtests();
}
* @param string NOPROXY
* @param bool HTTPSIGNOREPEER
* @param int HTTPSVERIFYHOST
+ * @param int SSLVERSION
*
* @copyright (C) 2007-2015 G. Giunta
* @license code licensed under the BSD License: see file license.txt
'HTTPSURI' => '/sw/xmlrpc/demo/server/server.php',
'HTTPSIGNOREPEER' => false,
'HTTPSVERIFYHOST' => 2,
+ 'SSLVERSION' => 0,
'PROXYSERVER' => null,
'NOPROXY' => false,
'LOCALPATH' => __DIR__,
if (isset($HTTPSVERIFYHOST)) {
$args['HTTPSVERIFYHOST'] = (int)$HTTPSVERIFYHOST;
}
+ if (isset($SSLVERSION)) {
+ $args['SSLVERSION'] = (int)$SSLVERSION;
+ }
if (isset($PROXY)) {
$arr = explode(':', $PROXY);
$args['PROXYSERVER'] = $arr[0];