Skip to content

Commit f69175f

Browse files
committed
added "cafile" option
1 parent 5f6964e commit f69175f

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

lib/ArangoDBClient/ConnectionOptions.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@ class ConnectionOptions implements \ArrayAccess
9999
* "allow self-signed" index constant
100100
*/
101101
const OPTION_ALLOW_SELF_SIGNED = 'allowSelfSigned';
102+
103+
/**
104+
* "caFile" index constant
105+
*/
106+
const OPTION_CA_FILE = 'caFile';
102107

103108
/**
104109
* ciphers allowed to be used in SSL
@@ -460,6 +465,7 @@ private static function getDefaults()
460465
self::OPTION_VERIFY_CERT => DefaultValues::DEFAULT_VERIFY_CERT,
461466
self::OPTION_VERIFY_CERT_NAME => DefaultValues::DEFAULT_VERIFY_CERT_NAME,
462467
self::OPTION_ALLOW_SELF_SIGNED => DefaultValues::DEFAULT_ALLOW_SELF_SIGNED,
468+
self::OPTION_CA_FILE => null,
463469
self::OPTION_CIPHERS => DefaultValues::DEFAULT_CIPHERS,
464470
self::OPTION_AUTH_USER => null,
465471
self::OPTION_AUTH_PASSWD => null,

lib/ArangoDBClient/HttpHelper.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ public static function createConnection(ConnectionOptions $options)
8989
stream_context_set_option($context, 'ssl', 'verify_peer', $options[ConnectionOptions::OPTION_VERIFY_CERT]);
9090
@stream_context_set_option($context, 'ssl', 'verify_peer_name', $options[ConnectionOptions::OPTION_VERIFY_CERT_NAME]);
9191
stream_context_set_option($context, 'ssl', 'allow_self_signed', $options[ConnectionOptions::OPTION_ALLOW_SELF_SIGNED]);
92+
93+
if (is_string(@$options[ConnectionOptions::OPTION_CA_FILE])) {
94+
stream_context_set_option($context, 'ssl', 'cafile', $options[ConnectionOptions::OPTION_CA_FILE]);
95+
}
9296

9397
if ($options[ConnectionOptions::OPTION_CIPHERS] !== null) {
9498
// SSL ciphers

0 commit comments

Comments
 (0)