private function StreamHandler::add_verify in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php \GuzzleHttp\Handler\StreamHandler::add_verify()
File
- vendor/
guzzlehttp/ guzzle/ src/ Handler/ StreamHandler.php, line 347
Class
- StreamHandler
- HTTP handler that uses PHP's HTTP stream wrapper.
Namespace
GuzzleHttp\HandlerCode
private function add_verify(RequestInterface $request, &$options, $value, &$params) {
if ($value === true) {
// PHP 5.6 or greater will find the system cert by default. When
// < 5.6, use the Guzzle bundled cacert.
if (PHP_VERSION_ID < 50600) {
$options['ssl']['cafile'] = \GuzzleHttp\default_ca_bundle();
}
}
elseif (is_string($value)) {
$options['ssl']['cafile'] = $value;
if (!file_exists($value)) {
throw new \RuntimeException("SSL CA bundle not found: {$value}");
}
}
elseif ($value === false) {
$options['ssl']['verify_peer'] = false;
return;
}
else {
throw new \InvalidArgumentException('Invalid verify request option');
}
$options['ssl']['verify_peer'] = true;
$options['ssl']['allow_self_signed'] = false;
}