src/Crate/PDO/Http/ServerPool.php
public function configure(PDOInterface $pdo): void
    {
        $sslMode = $pdo->getAttribute(PDO::CRATE_ATTR_SSL_MODE);

        $protocol = $sslMode === PDO::CRATE_ATTR_SSL_MODE_DISABLED ? 'http' : 'https';

        $options = [
            RequestOptions::TIMEOUT         => $pdo->getAttribute(PDO::ATTR_TIMEOUT),
            RequestOptions::CONNECT_TIMEOUT => $pdo->getAttribute(PDO::ATTR_TIMEOUT),
            RequestOptions::AUTH            => $pdo->getAttribute(PDO::CRATE_ATTR_HTTP_BASIC_AUTH) ?: null,
            RequestOptions::HEADERS         => [
                'Default-Schema' => $pdo->getAttribute(PDO::CRATE_ATTR_DEFAULT_SCHEMA),
            ],
        ];

        if ($sslMode === PDO::CRATE_ATTR_SSL_MODE_ENABLED_BUT_WITHOUT_HOST_VERIFICATION) {
            $options['verify'] = false;
        }

        $ca         = $pdo->getAttribute(PDO::CRATE_ATTR_SSL_CA_PATH);
        $caPassword = $pdo->getAttribute(PDO::CRATE_ATTR_SSL_CA_PASSWORD);

        if ($ca) {
            if ($caPassword) {
                $options[RequestOptions::VERIFY] = [$ca, $caPassword];
            } else {
                $options[RequestOptions::VERIFY] = $ca;
            }
        }

        $cert         = $pdo->getAttribute(PDO::CRATE_ATTR_SSL_CERT_PATH);
        $certPassword = $pdo->getAttribute(PDO::CRATE_ATTR_SSL_CERT_PASSWORD);

        if ($cert) {
            if ($certPassword) {
                $options[RequestOptions::CERT] = [$cert, $certPassword];
            } else {
                $options[RequestOptions::CERT] = $cert;
            }
        }

        $key         = $pdo->getAttribute(PDO::CRATE_ATTR_SSL_KEY_PATH);
        $keyPassword = $pdo->getAttribute(PDO::CRATE_ATTR_SSL_KEY_PASSWORD);

        if ($key) {
            if ($keyPassword) {
                $options[RequestOptions::SSL_KEY] = [$key, $keyPassword];
            } else {
                $options[RequestOptions::SSL_KEY] = $key;
            }
        }

        $this->protocol    = $protocol;
        $this->httpOptions = $options;
    }
public function configure(PDOInterface $pdo): void
    {
        $sslMode = $pdo->getAttribute(PDO::CRATE_ATTR_SSL_MODE);

        $protocol = $sslMode === PDO::CRATE_ATTR_SSL_MODE_DISABLED ? 'http' : 'https';

        $options = [
            RequestOptions::TIMEOUT         => $pdo->getAttribute(PDO::ATTR_TIMEOUT),
            RequestOptions::CONNECT_TIMEOUT => $pdo->getAttribute(PDO::ATTR_TIMEOUT),
            RequestOptions::AUTH            => $pdo->getAttribute(PDO::CRATE_ATTR_HTTP_BASIC_AUTH) ?: null,
            RequestOptions::HEADERS         => [
                'Default-Schema' => $pdo->getAttribute(PDO::CRATE_ATTR_DEFAULT_SCHEMA),
            ],
        ];

        if ($sslMode === PDO::CRATE_ATTR_SSL_MODE_ENABLED_BUT_WITHOUT_HOST_VERIFICATION) {
            $options['verify'] = false;
        }

        $ca         = $pdo->getAttribute(PDO::CRATE_ATTR_SSL_CA_PATH);
        $caPassword = $pdo->getAttribute(PDO::CRATE_ATTR_SSL_CA_PASSWORD);

        if ($ca) {
            if ($caPassword) {
                $options[RequestOptions::VERIFY] = [$ca, $caPassword];
            } else {
                $options[RequestOptions::VERIFY] = $ca;
            }
        }

        $cert         = $pdo->getAttribute(PDO::CRATE_ATTR_SSL_CERT_PATH);
        $certPassword = $pdo->getAttribute(PDO::CRATE_ATTR_SSL_CERT_PASSWORD);

        if ($cert) {
            if ($certPassword) {
                $options[RequestOptions::CERT] = [$cert, $certPassword];
            } else {
                $options[RequestOptions::CERT] = $cert;
            }
        }

        $key         = $pdo->getAttribute(PDO::CRATE_ATTR_SSL_KEY_PATH);
        $keyPassword = $pdo->getAttribute(PDO::CRATE_ATTR_SSL_KEY_PASSWORD);

        if ($key) {
            if ($keyPassword) {
                $options[RequestOptions::SSL_KEY] = [$key, $keyPassword];
            } else {
                $options[RequestOptions::SSL_KEY] = $key;
            }
        }

        $this->protocol    = $protocol;
        $this->httpOptions = $options;
    }
public function configure ( PDOInterface $ pdo ) : void { $ sslMode = $ pdo -> getAttribute ( PDO :: CRATE_ATTR_SSL_MODE ) ; $ protocol = $ sslMode === PDO :: CRATE_ATTR_SSL_MODE_DISABLED ? 'http' : 'https' ; $ options = [ RequestOptions :: TIMEOUT => $ pdo -> getAttribute ( PDO :: ATTR_TIMEOUT ) , RequestOptions :: CONNECT_TIMEOUT => $ pdo -> getAttribute ( PDO :: ATTR_TIMEOUT ) , RequestOptions :: AUTH => $ pdo -> getAttribute ( PDO :: CRATE_ATTR_HTTP_BASIC_AUTH ) ? : null , RequestOptions :: HEADERS => [ 'Default-Schema' => $ pdo -> getAttribute ( PDO :: CRATE_ATTR_DEFAULT_SCHEMA ) , ] , ] ; if ( $ sslMode === PDO :: CRATE_ATTR_SSL_MODE_ENABLED_BUT_WITHOUT_HOST_VERIFICATION ) { $ options [ 'verify' ] = false ; } $ ca = $ pdo -> getAttribute ( PDO :: CRATE_ATTR_SSL_CA_PATH ) ; $ caPassword = $ pdo -> getAttribute ( PDO :: CRATE_ATTR_SSL_CA_PASSWORD ) ; if ( $ ca ) { if ( $ caPassword ) { $ options [ RequestOptions :: VERIFY ] = [ $ ca , $ caPassword ] ; } else { $ options [ RequestOptions :: VERIFY ] = $ ca ; } } $ cert = $ pdo -> getAttribute ( PDO :: CRATE_ATTR_SSL_CERT_PATH ) ; $ certPassword = $ pdo -> getAttribute ( PDO :: CRATE_ATTR_SSL_CERT_PASSWORD ) ; if ( $ cert ) { if ( $ certPassword ) { $ options [ RequestOptions :: CERT ] = [ $ cert , $ certPassword ] ; } else { $ options [ RequestOptions :: CERT ] = $ cert ; } } $ key = $ pdo -> getAttribute ( PDO :: CRATE_ATTR_SSL_KEY_PATH ) ; $ keyPassword = $ pdo -> getAttribute ( PDO :: CRATE_ATTR_SSL_KEY_PASSWORD ) ; if ( $ key ) { if ( $ keyPassword ) { $ options [ RequestOptions :: SSL_KEY ] = [ $ key , $ keyPassword ] ; } else { $ options [ RequestOptions :: SSL_KEY ] = $ key ; } } $ this -> protocol = $ protocol ; $ this -> httpOptions = $ options ; }
Reconfigure the the server pool based on the attributes in PDO

@param PDOInterface $pdo
Reconfigure the the server pool based on the attributes in PDO