mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Fix linter issues
This commit is contained in:
parent
04751df30c
commit
3721ca9113
2 changed files with 11 additions and 11 deletions
|
|
@ -14,7 +14,8 @@
|
||||||
},
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
"eslint/no-console": "error",
|
"eslint/no-console": "error",
|
||||||
"eslint/no-empty": "error"
|
"eslint/no-empty": "error",
|
||||||
|
"eslint/no-undef": "error"
|
||||||
},
|
},
|
||||||
"overrides": [
|
"overrides": [
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,15 @@ export function mitmConnect(req, clientSocket, isAllowed) {
|
||||||
|
|
||||||
const server = createHttpsServer(hostname, 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
|
// Establish the connection
|
||||||
clientSocket.write("HTTP/1.1 200 Connection Established\r\n\r\n");
|
clientSocket.write("HTTP/1.1 200 Connection Established\r\n\r\n");
|
||||||
|
|
||||||
|
|
@ -46,16 +55,6 @@ function createHttpsServer(hostname, isAllowed) {
|
||||||
handleRequest
|
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;
|
return server;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue