Skip to content

Commit e10babe

Browse files
committed
fix for the issue #13
1 parent d8c7a58 commit e10babe

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

src/HttpClients/core/ClientFactory.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class ClientFactory
88
public static function buildCurlClient(
99
int $connectionTimeOut = 10,
1010
int $requestTimeOut = 100,
11-
bool $isVerify = true
11+
bool $isVerify = false
1212
) {
1313
$client = new HttpCurlClient();
1414
$client->setVerifySSL($isVerify);
@@ -19,7 +19,7 @@ public static function buildCurlClient(
1919
public static function buildGuzzleClient(
2020
int $connectionTimeOut = 10,
2121
int $requestTimeOut = 100,
22-
bool $isVerify = true
22+
bool $isVerify = false
2323
) {
2424
$client = new GuzzleClient();
2525
$client->setVerifySSL($isVerify);

src/HttpClients/core/HttpCurlClient.php

+2-7
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ private function prepare(RequestInterface $request) : void
115115
} else {
116116
$this->baseCurl->setupOption(CURLOPT_CUSTOMREQUEST, $request->getMethod());
117117
}
118+
$this->baseCurl->setupOption(CURLOPT_SSL_VERIFYPEER, true);
118119
if ($this->isVerifySSL) {
119120
$this->setSSLConfig();
120121
} else {
@@ -145,19 +146,13 @@ private function setPostBodyAndMethod(RequestInterface $request)
145146

146147
private function setSSLConfig()
147148
{
148-
$tlsVersion = $this->baseCurl->versionOfTLS();
149-
$versions = ['TLS 1.2', 'TLS 1.3'];
150-
if (!in_array($tlsVersion, $versions)) {
151-
throw new \RuntimeException("Error. Checking TLS 1.2/1.3 version failed. Please make sure your PHP cURL supports TSL 1.2/1.3");
152-
}
153-
$this->baseCurl->setupOption(CURLOPT_SSL_VERIFYPEER, true);
154149
$this->baseCurl->setupOption(CURLOPT_SSL_VERIFYHOST, 2);
155150
$this->baseCurl->setupOption(CURLOPT_CAINFO, CoreConstants::getCertPath());
156151
}
157152

158153
private function acceptAll()
159154
{
160-
$this->baseCurl->setupOption(CURLOPT_SSL_VERIFYPEER, false);
155+
$this->baseCurl->setupOption(CURLOPT_SSL_VERIFYHOST, 0);
161156
}
162157

163158
private function updateCurlSettings()

0 commit comments

Comments
 (0)