private function verify(RequestInterface $httpRequest)
    {
        $extensions = array('crt', 'pem', 'cer', 'der');
        $caDir = __DIR__ . '/../CA/';

        // Must be https
        $url = $httpRequest->getUrl();
        if (substr($url, 0, 5) != 'https') {
            $httpRequest->getConfig()->set('verify', false);
            return;
        }

        // Default
        $httpRequest->getConfig()->set('verify', $caDir . 'curl-ca-bundle.crt');

        // Look for a host specific CA file
        $host = strtolower(parse_url($url, PHP_URL_HOST));
        if (!$host)
            return;

        $filename = $host;
        do {
            // Look for the possible extensions
            foreach ($extensions as $ext)
                if (file_exists($verify = $caDir . $filename . '.' . $ext)) {
                    $httpRequest->getConfig()->set('verify', $verify);
                    return;
                }

            // Remove a subdomain each time
            $filename = substr($filename, strpos($filename, '.') + 1);
        } while (substr_count($filename, '.') > 0);

        // No specific match
        return;
    }
private function verify(RequestInterface $httpRequest)
    {
        $extensions = array('crt', 'pem', 'cer', 'der');
        $caDir = __DIR__ . '/../CA/';

        // Must be https
        $url = $httpRequest->getUrl();
        if (substr($url, 0, 5) != 'https') {
            $httpRequest->getConfig()->set('verify', false);
            return;
        }

        // Default
        $httpRequest->getConfig()->set('verify', $caDir . 'curl-ca-bundle.crt');

        // Look for a host specific CA file
        $host = strtolower(parse_url($url, PHP_URL_HOST));
        if (!$host)
            return;

        $filename = $host;
        do {
            // Look for the possible extensions
            foreach ($extensions as $ext)
                if (file_exists($verify = $caDir . $filename . '.' . $ext)) {
                    $httpRequest->getConfig()->set('verify', $verify);
                    return;
                }

            // Remove a subdomain each time
            $filename = substr($filename, strpos($filename, '.') + 1);
        } while (substr_count($filename, '.') > 0);

        // No specific match
        return;
    }
private function verify ( RequestInterface $ httpRequest ) { $ extensions = array ( 'crt' , 'pem' , 'cer' , 'der' ) ; $ caDir = __DIR__ . '/../CA/' ; // Must be https $ url = $ httpRequest -> getUrl ( ) ; if ( substr ( $ url , 0 , 5 ) != 'https' ) { $ httpRequest -> getConfig ( ) -> set ( 'verify' , false ) ; return ; } // Default $ httpRequest -> getConfig ( ) -> set ( 'verify' , $ caDir . 'curl-ca-bundle.crt' ) ; // Look for a host specific CA file $ host = strtolower ( parse_url ( $ url , PHP_URL_HOST ) ) ; if ( ! $ host ) return ; $ filename = $ host ; do { // Look for the possible extensions foreach ( $ extensions as $ ext ) if ( file_exists ( $ verify = $ caDir . $ filename . '.' . $ ext ) ) { $ httpRequest -> getConfig ( ) -> set ( 'verify' , $ verify ) ; return ; } // Remove a subdomain each time $ filename = substr ( $ filename , strpos ( $ filename , '.' ) + 1 ) ; } while ( substr_count ( $ filename , '.' ) > 0 ) ; // No specific match return ; }
Looks for a Certificate Authority file in the CA folder
that matches the host and update the 'verify' option
to its full path.
If no specific file regarding a host is found, uses
curl-ca-bundle.crt by default.
@param RequestInterface $httpRequest
Looks for a Certificate Authority file in the CA folder that matches the host and update the verify option to its full path . If no specific file regarding a host is found uses curl - ca - bundle . crt by default .