mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 20:20:49 +00:00
Merge pull request #131 from AikidoSec/fix-linter-issues
Fix linter issues
This commit is contained in:
commit
d5dc801c00
2 changed files with 11 additions and 11 deletions
|
|
@ -14,7 +14,8 @@
|
|||
},
|
||||
"rules": {
|
||||
"eslint/no-console": "error",
|
||||
"eslint/no-empty": "error"
|
||||
"eslint/no-empty": "error",
|
||||
"eslint/no-undef": "error"
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue