Skip to content

Commit 5bd1f22

Browse files
committed
Merge branch 'amqp-lib-ingore-empty-ssl-options' into amqp-add-ssl-pass-phrase-option
2 parents 46c482e + f5d43a8 commit 5bd1f22

2 files changed

Lines changed: 13 additions & 11 deletions

File tree

‎pkg/amqp-lib/AmqpConnectionFactory.php‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,19 +87,21 @@ private function establishConnection()
8787
if (false == $this->connection) {
8888
if ($this->config->getOption('stream')) {
8989
if ($this->config->isSslOn()) {
90+
$sslOptions = array_filter([
91+
'cafile' => $this->config->getSslCaCert(),
92+
'local_cert' => $this->config->getSslCert(),
93+
'local_pk' => $this->config->getSslKey(),
94+
'verify_peer' => $this->config->isSslVerify(),
95+
'verify_peer_name' => $this->config->isSslVerify(),
96+
], function ($value) { return '' !== $value; });
97+
9098
$con = new AMQPSSLConnection(
9199
$this->config->getHost(),
92100
$this->config->getPort(),
93101
$this->config->getUser(),
94102
$this->config->getPass(),
95103
$this->config->getVHost(),
96-
[
97-
'cafile' => $this->config->getSslCaCert(),
98-
'local_cert' => $this->config->getSslCert(),
99-
'local_pk' => $this->config->getSslKey(),
100-
'verify_peer' => $this->config->isSslVerify(),
101-
'verify_peer_name' => $this->config->isSslVerify(),
102-
],
104+
$sslOptions,
103105
[
104106
'insist' => $this->config->getOption('insist'),
105107
'login_method' => $this->config->getOption('login_method'),

‎pkg/amqp-tools/ConnectionConfig.php‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -296,23 +296,23 @@ public function isSslVerify()
296296
}
297297

298298
/**
299-
* @return bool
299+
* @return string
300300
*/
301301
public function getSslCaCert()
302302
{
303303
return $this->getOption('ssl_cacert');
304304
}
305305

306306
/**
307-
* @return bool
307+
* @return string
308308
*/
309309
public function getSslCert()
310310
{
311311
return $this->getOption('ssl_cert');
312312
}
313313

314314
/**
315-
* @return bool
315+
* @return string
316316
*/
317317
public function getSslKey()
318318
{
@@ -331,7 +331,7 @@ public function getSslPassPhrase()
331331
* @param string $name
332332
* @param mixed $default
333333
*
334-
* @return bool
334+
* @return mixed
335335
*/
336336
public function getOption($name, $default = null)
337337
{

0 commit comments

Comments
 (0)