Skip to content

Commit cc4450c

Browse files
authored
Revert back to w/o timeout (#379)
* Revert back to w/o timeout It turns out that `{timeout: 1500}` sets a timeout for the entire request to finish but throws when it is exceeded. This error would need to get caught and then decided upon what to do which complicates things. Changed the order so that page.goto can be awaited but still closed after a timeout. * Update bot.js
1 parent 4ce6f66 commit cc4450c

File tree

1 file changed

+3
-4
lines changed
  • dist/challenge-templates/xss-bot/challenge

1 file changed

+3
-4
lines changed

dist/challenge-templates/xss-bot/challenge/bot.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const DOMAIN = process.env.DOMAIN;
66
if (DOMAIN == undefined) throw 'domain undefined'
77
const REGISTERED_DOMAIN = process.env.REGISTERED_DOMAIN;
88
const BLOCK_SUBORIGINS = process.env.BLOCK_SUBORIGINS == "1";
9+
const BOT_TIMEOUT = process.env.BOT_TIMEOUT || 60*1000;
910

1011
// will only be used if BLOCK_SUBORIGINS is enabled
1112
const PAC_B64 = Buffer.from(`
@@ -53,9 +54,6 @@ if (BLOCK_SUBORIGINS) {
5354
const page = await context.newPage();
5455
await page.setCookie(cookie);
5556
socket.write(`Loading page ${url}.\n`);
56-
await page.goto(url, {
57-
timeout: 1500 /* add 1.5s margin for network delays */
58-
});
5957
setTimeout(()=>{
6058
try {
6159
context.close();
@@ -64,7 +62,8 @@ if (BLOCK_SUBORIGINS) {
6462
} catch (err) {
6563
console.log(`err: ${err}`);
6664
}
67-
}, 60000);
65+
}, BOT_TIMEOUT);
66+
await page.goto(url);
6867
}
6968

7069
var server = net.createServer();

0 commit comments

Comments
 (0)