forked from loafle/openapi-generator-original
Merge pull request #1396 from akkie/disable-ssl-verification
Allow to disable SSL verification
This commit is contained in:
commit
a2fda604f8
@ -165,6 +165,12 @@ class ApiClient
|
||||
|
||||
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
|
||||
|
||||
// disable SSL verification, if needed
|
||||
if ($this->config->getSSLVerification() == false) {
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
|
||||
}
|
||||
|
||||
if (! empty($queryParams)) {
|
||||
$url = ($url . '?' . http_build_query($queryParams));
|
||||
}
|
||||
|
@ -126,6 +126,15 @@ class Configuration
|
||||
*/
|
||||
protected $tempFolderPath;
|
||||
|
||||
/**
|
||||
* Indicates if SSL verification should be enabled or disabled.
|
||||
*
|
||||
* This is useful if the host uses a self-signed SSL certificate.
|
||||
*
|
||||
* @var boolean True if the certificate should be validated, false otherwise.
|
||||
*/
|
||||
protected $sslVerification = true;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
@ -418,6 +427,29 @@ class Configuration
|
||||
return $this->tempFolderPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets if SSL verification should be enabled or disabled
|
||||
*
|
||||
* @param boolean $sslVerification True if the certificate should be validated, false otherwise
|
||||
*
|
||||
* @return Configuration
|
||||
*/
|
||||
public function setSSLVerification($sslVerification)
|
||||
{
|
||||
$this->sslVerification = $sslVerification;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets if SSL verification should be enabled or disabled
|
||||
*
|
||||
* @return boolean True if the certificate should be validated, false otherwise
|
||||
*/
|
||||
public function getSSLVerification()
|
||||
{
|
||||
return $this->sslVerification;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the default configuration instance
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user