Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions lib/ApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,19 @@ public function callApi($resourcePath, $method, $queryParams, $postData, $header
curl_setopt($curl, CURLOPT_PROXYUSERPWD, $this->config->getCurlProxyUser() . ':' .$this->config->getCurlProxyPassword());
}

if ($this->config->getTlsVersion()) {
curl_setopt($curl, CURLOPT_SSLVERSION, $this->config->getTlsVersion());
}

if ($this->config->getTlsCipherList()) {
// use TLS 1.3 ciphers for TLS 1.3, otherwise use general SSL cipher list
if ($this->config->getTlsVersion() && $this->config->getTlsVersion() === CURL_SSLVERSION_TLSv1_3) {
curl_setopt($curl, CURLOPT_TLS13_CIPHERS, $this->config->getTlsCipherList());
} else {
curl_setopt($curl, CURLOPT_SSL_CIPHER_LIST, $this->config->getTlsCipherList());
}
}

if (!empty($queryParams)) {
$url = ($url . '?' . http_build_query($queryParams));
}
Expand Down
61 changes: 61 additions & 0 deletions lib/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,20 @@ class Configuration
*/
protected $allowEncoding = false;

/**
* TLS version to use for HTTPS requests
*
* @var string
*/
protected $tlsVersion;

/**
* TLS cipher list to use for HTTPS requests
*
* @var string
*/
protected $tlsCipherList;

/**
* Logging configuration
*
Expand Down Expand Up @@ -572,6 +586,53 @@ public function getLogConfiguration()
return $this->logConfig;
}


/**
* Sets the TLS version to use for HTTPS requests
*
* @param string $tlsVersion TLS version (e.g. CURL_SSLVERSION_TLSv1_2)
*
* @return $this
*/
public function setTlsVersion($tlsVersion)
{
$this->tlsVersion = $tlsVersion;
return $this;
}

/**
* Gets the TLS version to use for HTTPS requests
*
* @return string TLS version
*/
public function getTlsVersion()
{
return $this->tlsVersion;
}

/**
* Sets the TLS cipher list to use for HTTPS requests
*
* @param string $tlsCipherList TLS cipher list
*
* @return $this
*/
public function setTlsCipherList($tlsCipherList)
{
$this->tlsCipherList = $tlsCipherList;
return $this;
}

/**
* Gets the TLS cipher list to use for HTTPS requests
*
* @return string TLS cipher list
*/
public function getTlsCipherList()
{
return $this->tlsCipherList;
}

/**
* Sets the HTTP Proxy Host
*
Expand Down