Skip to content

Commit

Permalink
Support cacert verification in ProviderClient
Browse files Browse the repository at this point in the history
  • Loading branch information
joostfaassen committed Aug 6, 2016
1 parent bf739b0 commit 212c7f5
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/Provider/ProviderClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ public function __construct($username = null, $password = null)
$this->username = $username;
$this->password = $password;
$this->httpClient = new GuzzleClient();


$this->verify = __DIR__ . '/../../cacert.pem';
if (!file_exists($this->verify)) {
throw new RuntimeException('cacert.pem not found: ' . $this->verify);
}
}


Expand Down Expand Up @@ -75,7 +81,10 @@ private function getResourceDataV1(Resource $resource, Source $source)
//echo "REQUESTING: " . $fullUrl . "\n";
$res = $this->httpClient->get(
$url,
[ 'headers' => $headers ]
[
'headers' => $headers,
'verify' => $this->verify
]
);
if ($res->getStatusCode() == 200) {
$res = (string)$res->getBody();
Expand Down Expand Up @@ -103,7 +112,8 @@ private function getResourceDataV3(Source $source)
$res = $this->httpClient->get(
$url,
[
'headers' => []
'headers' => [],
'verify' => $this->verify
]
);
if ($res->getStatusCode() == 200) {
Expand Down

0 comments on commit 212c7f5

Please sign in to comment.