@@ -74,10 +74,6 @@ public function getConfig(): ConnectionConfig
74
74
75
75
private function establishConnection (): BunnyClient
76
76
{
77
- if ($ this ->config ->isSslOn ()) {
78
- throw new \LogicException ('The bunny library does not support SSL connections ' );
79
- }
80
-
81
77
if (false == $ this ->client ) {
82
78
$ bunnyConfig = [];
83
79
$ bunnyConfig ['host ' ] = $ this ->config ->getHost ();
@@ -102,6 +98,20 @@ private function establishConnection(): BunnyClient
102
98
$ bunnyConfig ['tcp_nodelay ' ] = $ this ->config ->getOption ('tcp_nodelay ' );
103
99
}
104
100
101
+ if ($ this ->config ->isSslOn ()) {
102
+ $ sslOptions = array_filter ([
103
+ 'cafile ' => $ this ->config ->getSslCaCert (),
104
+ 'local_cert ' => $ this ->config ->getSslCert (),
105
+ 'local_pk ' => $ this ->config ->getSslKey (),
106
+ 'verify_peer ' => $ this ->config ->isSslVerify (),
107
+ 'verify_peer_name ' => $ this ->config ->isSslVerify (),
108
+ 'passphrase ' => $ this ->getConfig ()->getSslPassPhrase (),
109
+ 'ciphers ' => $ this ->config ->getOption ('ciphers ' , '' ),
110
+ ], function ($ value ) { return '' !== $ value ; });
111
+
112
+ $ bunnyConfig ['ssl ' ] = $ sslOptions ;
113
+ }
114
+
105
115
$ this ->client = new BunnyClient ($ bunnyConfig );
106
116
$ this ->client ->connect ();
107
117
}
0 commit comments