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,12 +642,14 @@ module.exports.CreateWebRelay = function (parent, db, args, domain) {
}
} else {
// Tunnel is now in web socket pass-thru mode
if ((typeof header.connection == 'string') && (header.connection.toLowerCase() == 'upgrade')) {
// Websocket upgrade succesful
obj.socketParseState = 2;
} else {
// Unable to upgrade to web socket
obj.close();
if (header != null) {
if ((typeof header.connection == 'string') && (header.connection.toLowerCase() == 'upgrade')) {
// Websocket upgrade succesful
obj.socketParseState = 2;
} else {
// Unable to upgrade to web socket
obj.close();
}
}
}
}