Commit fa3e7132 authored by echicken's avatar echicken 🐔
Browse files

Avoid spurious connections to the terminal server - and some

other unnecessary work - if the BBS is using HAProxy but we can't
do the thing with the stuff because we don't have the things.
parent 820b805e
......@@ -47,6 +47,11 @@ var FWebSocketState = WEBSOCKET_NEED_PACKET_START;
try {
// Parse and respond to the WebSocket handshake request
if (ShakeHands()) {
if (UsingHAProxy() && FWebSocketHeader['X-Forwarded-For'] === undefined) {
throw new Error('BBS is using HAProxy, but no X-Forwarded-For header present.');
}
SendToWebSocketClient(StringToBytes("Redirecting to server...\r\n"));
// Default to localhost on the telnet port
......@@ -88,11 +93,7 @@ try {
var ServerData = [];
if (UsingHAProxy()) {
if (FWebSocketHeader['X-Forwarded-For'] !== undefined) {
// Do HAProxy stuff here
} else {
throw new Error('BBS is using HAProxy, but no X-Forwarded-For header present.');
}
// Do HAProxy stuff here
}
// Loop while we're still connected on both ends
......
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