Commit 505c4e35 authored by Carsten  Rose's avatar Carsten Rose

Refs #11076. Activates 'ssl' for 'wss' sockets.

parent f07a0c9d
Pipeline #3756 passed with stages
in 4 minutes and 12 seconds
......@@ -30,7 +30,6 @@ use IMATHUZH\Qfq\Core\Helper\Support;
use IMATHUZH\Qfq\Core\Helper\Token;
use IMATHUZH\Qfq\Core\Store\Sip;
use IMATHUZH\Qfq\Core\Store\Store;
use IMATHUZH\Qfq\Core\Report\WebSocket;
/*
* a:AltText
......@@ -547,6 +546,14 @@ class Link {
, ERROR_MISSING_VALUE);
}
// Check for wss >> ssl
if ($urlParts['scheme'] == 'wss') {
$urlParts['host'] = 'ssl://' . $urlParts['host'];
if ($urlParts['port'] == 0) {
$urlParts['port'] = 443;
}
}
// Open Socket
if (false === $websocket->connect($urlParts['host'], $urlParts['port'], $urlParts['path'])) {
throw new \UserFormException(json_encode([ERROR_MESSAGE_TO_USER => 'Failed connect websocket',
......
......@@ -62,6 +62,7 @@ class WebSocket {
* @return bool
*/
public function sendData(string $data, string $type = 'text', bool $masked = true) {
if ($this->connected === false) {
trigger_error("Not connected", E_USER_WARNING);
return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment