Merge pull request #131 from AikidoSec/fix-linter-issues

Fix linter issues
This commit is contained in:
Sander Declerck 2025-10-31 14:18:25 +01:00 committed by GitHub
commit d5dc801c00
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 11 deletions

View file

@ -14,7 +14,8 @@
},
"rules": {
"eslint/no-console": "error",
"eslint/no-empty": "error"
"eslint/no-empty": "error",
"eslint/no-undef": "error"
},
"overrides": [
{

View file

@ -14,6 +14,15 @@ export function mitmConnect(req, clientSocket, isAllowed) {
const server = createHttpsServer(hostname, isAllowed);
server.on("error", (err) => {
ui.writeError(`Safe-chain: HTTPS server error: ${err.message}`);
if (!clientSocket.headersSent) {
clientSocket.end("HTTP/1.1 502 Bad Gateway\r\n\r\n");
} else if (clientSocket.writable) {
clientSocket.end();
}
});
// Establish the connection
clientSocket.write("HTTP/1.1 200 Connection Established\r\n\r\n");
@ -46,16 +55,6 @@ function createHttpsServer(hostname, isAllowed) {
handleRequest
);
server.on("error", (err) => {
ui.writeError(`Safe-chain: HTTPS server error: ${err.message}`);
if (!res.headersSent) {
res.writeHead(502);
res.end("Bad Gateway");
} else if (res.writable) {
res.destroy();
}
});
return server;
}