xp-forge / mongodb

MongoDB for the XP Framework
0 stars 0 forks source link

SSL support #2

Closed thekid closed 3 years ago

thekid commented 3 years ago

Following the $this->conn->connect() call, the following needs to be added:

if (isset($this->options['ssl'])) {
  if (!stream_socket_enable_crypto($this->conn->getHandle(), true, STREAM_CRYPTO_METHOD_ANY_CLIENT)) {
    $e= new ConnectException('SSL handshake failed');
    \xp::gc(__FILE__);
    throw $e;
  }
}
thekid commented 3 years ago

See https://docs.mongodb.com/manual/reference/connection-string/ - support ssl=true as well as tls=true.