Skip to content

Commit 82ae725

Browse files
committed
Merge pull request #107 from cherrytech/feature/tlsv1_2-support
Add support for TLS v1.2
2 parents 2b3624b + c1cedb9 commit 82ae725

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/Message/AbstractRequest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,9 @@ protected function getItemData()
314314
public function sendData($data)
315315
{
316316
$url = $this->getEndpoint().'?'.http_build_query($data, '', '&');
317-
$httpResponse = $this->httpClient->get($url)->send();
317+
$httpRequest = $this->httpClient->get($url);
318+
$httpRequest->getCurlOptions()->set(CURLOPT_SSLVERSION, 6); // CURL_SSLVERSION_TLSv1_2 for libcurl < 7.35
319+
$httpResponse = $httpRequest->send();
318320

319321
return $this->createResponse($httpResponse->getBody());
320322
}

src/Message/AbstractRestRequest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ function ($event) {
163163
// echo "Data == " . json_encode($data) . "\n";
164164

165165
try {
166+
$httpRequest->getCurlOptions()->set(CURLOPT_SSLVERSION, 6); // CURL_SSLVERSION_TLSv1_2 for libcurl < 7.35
166167
$httpResponse = $httpRequest->send();
167168
return $this->response = $this->createResponse($httpResponse->json(), $httpResponse->getStatusCode());
168169
} catch (\Exception $e) {

0 commit comments

Comments
 (0)