1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-02-12 11:01:52 +00:00

Merge pull request #4218 from si458/patch-1

if header is not null for websockets
This commit is contained in:
Ylian Saint-Hilaire 2022-07-03 19:35:53 -07:00 committed by GitHub
commit 513e5b5ade
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -642,6 +642,7 @@ module.exports.CreateWebRelay = function (parent, db, args, domain) {
}
} else {
// Tunnel is now in web socket pass-thru mode
if (header != null) {
if ((typeof header.connection == 'string') && (header.connection.toLowerCase() == 'upgrade')) {
// Websocket upgrade succesful
obj.socketParseState = 2;
@ -651,6 +652,7 @@ module.exports.CreateWebRelay = function (parent, db, args, domain) {
}
}
}
}
// Send data thru the relay tunnel. Written to use TLS if needed.
function send(data) { try { if (obj.tls) { obj.tls.write(data); } else { obj.wsClient.send(data); } } catch (ex) { } }