End clientsocket without 502 in case of proxySocket error

This commit is contained in:
Sander Declerck 2025-10-31 11:41:39 +01:00
parent 4dc14397ad
commit 78fd93b72a
No known key found for this signature in database

View file

@ -102,13 +102,16 @@ function tunnelRequestViaProxy(req, clientSocket, head, proxyUrl) {
proxy.port || 8080
} - ${err.message}`
);
if (clientSocket.writable) {
clientSocket.end("HTTP/1.1 502 Bad Gateway\r\n\r\n");
}
} else {
ui.writeError(
`Safe-chain: proxy socket error after connection - ${err.message}`
);
}
if (clientSocket.writable) {
clientSocket.end("HTTP/1.1 502 Bad Gateway\r\n\r\n");
clientSocket.end();
}
}
});