mirror of
https://github.com/Lissy93/web-check.git
synced 2026-05-12 21:00:38 -04:00
ref: Remove per-job timeouts
This commit is contained in:
@@ -7,7 +7,6 @@ const queryDns = async (domain, type) => {
|
||||
const res = await httpGet('https://dns.google/resolve', {
|
||||
params: { name: domain, type },
|
||||
headers: { Accept: 'application/dns-json' },
|
||||
timeout: 5000,
|
||||
});
|
||||
return res.data;
|
||||
};
|
||||
|
||||
@@ -22,18 +22,12 @@ const evaluate = (header) => {
|
||||
return verdict('Site is compatible with the HSTS preload list!', true, header);
|
||||
};
|
||||
|
||||
const REQUEST_TIMEOUT = 5000;
|
||||
|
||||
const hstsHandler = async (url) =>
|
||||
new Promise((resolve) => {
|
||||
const req = https.request(url, (res) => {
|
||||
resolve(evaluate(res.headers['strict-transport-security']));
|
||||
res.resume();
|
||||
});
|
||||
req.setTimeout(REQUEST_TIMEOUT, () => {
|
||||
req.destroy();
|
||||
resolve({ error: 'HSTS check timed out' });
|
||||
});
|
||||
req.on('error', (e) => resolve({ error: `HSTS check failed: ${e.message}` }));
|
||||
req.end();
|
||||
});
|
||||
|
||||
@@ -10,10 +10,7 @@ const rankHandler = async (url) => {
|
||||
? { auth: { username: TRANCO_USERNAME, password: TRANCO_API_KEY } }
|
||||
: {};
|
||||
try {
|
||||
const response = await httpGet(`https://tranco-list.eu/api/ranks/domain/${domain}`, {
|
||||
timeout: 5000,
|
||||
...auth,
|
||||
});
|
||||
const response = await httpGet(`https://tranco-list.eu/api/ranks/domain/${domain}`, auth);
|
||||
if (!response.data?.ranks?.length) {
|
||||
return {
|
||||
skipped: `${domain} isn't ranked in the top 1 million sites yet`,
|
||||
|
||||
@@ -9,9 +9,7 @@ const shodanHandler = async (url) => {
|
||||
if (auth.skipped) return auth;
|
||||
const { hostname } = parseTarget(url);
|
||||
try {
|
||||
const res = await httpGet(`https://api.shodan.io/shodan/host/${hostname}?key=${auth.value}`, {
|
||||
timeout: 8000,
|
||||
});
|
||||
const res = await httpGet(`https://api.shodan.io/shodan/host/${hostname}?key=${auth.value}`);
|
||||
return res.data;
|
||||
} catch (error) {
|
||||
return upstreamError(error, 'Shodan lookup');
|
||||
|
||||
@@ -11,7 +11,6 @@ const tlsLabsHandler = async (url) => {
|
||||
try {
|
||||
const res = await httpGet(SSL_LABS, {
|
||||
params: { host: hostname, fromCache: 'on', maxAge: 168, all: 'done' },
|
||||
timeout: 8000,
|
||||
headers: { 'User-Agent': 'web-check (https://web-check.xyz)' },
|
||||
});
|
||||
const data = res.data;
|
||||
|
||||
Reference in New Issue
Block a user