fix(aep-15): la récupération de page refuse les adresses internes
lib/recupererPage.js : http(s) seulement, port par défaut, ni identifiants ni nom d'hôte local, toutes les IP résolues publiques ; redirections suivies à la main et contrôlées à chaque saut (au plus 5). enrich.js s'en sert à la place de fetchCapped et garde l'adresse finale et la chaîne de redirections. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+10
-40
@@ -21,7 +21,8 @@ import { spawnSync, execSync } from 'child_process';
|
||||
import { existsSync, writeFileSync, unlinkSync, readFileSync, mkdirSync } from 'fs';
|
||||
import { dirname, join } from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { messageFicheEnrichie } from './lib/messageNtfy.js';
|
||||
import { messageFicheEnrichie, hoteDuLien } from './lib/messageNtfy.js';
|
||||
import { recupererPage } from './lib/recupererPage.js';
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
@@ -48,11 +49,8 @@ const WORKER_PRICE_IN = parseFloat(process.env.WORKER_PRICE_IN_USD_PER_M || '0')
|
||||
const WORKER_PRICE_OUT = parseFloat(process.env.WORKER_PRICE_OUT_USD_PER_M || '0') / 1_000_000;
|
||||
const USD_TO_EUR = 0.93;
|
||||
|
||||
// Scrape léger
|
||||
const SCRAPE_TIMEOUT_MS = 8_000;
|
||||
const SCRAPE_MAX_BYTES = 500_000;
|
||||
// Scrape léger (délai, plafond d'octets et User-Agent : lib/recupererPage.js)
|
||||
const SCRAPE_TEXT_MAX_CHARS = 4_000;
|
||||
const SCRAPE_USER_AGENT = 'AEP/2.0 contact@trans-former.fr';
|
||||
|
||||
// ─── CLI ──────────────────────────────────────────────────────────────────────
|
||||
const DRY_RUN = process.argv.includes('--dry-run');
|
||||
@@ -230,39 +228,8 @@ function extractLinks(row) {
|
||||
}
|
||||
|
||||
// ─── SCRAPE LÉGER (fetch natif, pas de crawl4ai) ─────────────────────────────
|
||||
async function fetchCapped(url) {
|
||||
const controller = new AbortController();
|
||||
const timer = setTimeout(() => controller.abort(), SCRAPE_TIMEOUT_MS);
|
||||
try {
|
||||
const res = await fetch(url, {
|
||||
signal: controller.signal,
|
||||
redirect: 'follow',
|
||||
headers: { 'User-Agent': SCRAPE_USER_AGENT },
|
||||
});
|
||||
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
||||
|
||||
const reader = res.body?.getReader();
|
||||
if (!reader) return await res.text();
|
||||
|
||||
const chunks = [];
|
||||
let total = 0;
|
||||
while (true) {
|
||||
const { done, value } = await reader.read();
|
||||
if (done) break;
|
||||
chunks.push(value);
|
||||
total += value.length;
|
||||
if (total >= SCRAPE_MAX_BYTES) {
|
||||
await reader.cancel().catch(() => {});
|
||||
break;
|
||||
}
|
||||
}
|
||||
const buf = Buffer.concat(chunks.map(c => Buffer.from(c)));
|
||||
return buf.subarray(0, SCRAPE_MAX_BYTES).toString('utf-8');
|
||||
} finally {
|
||||
clearTimeout(timer);
|
||||
}
|
||||
}
|
||||
|
||||
// Lot 15 : la récupération passe par lib/recupererPage.js, qui refuse les adresses internes
|
||||
// avant l'appel et après chaque redirection (suivie à la main) ; 8 s, 500 Ko, comme avant.
|
||||
function extractMeta(html, key) {
|
||||
const re1 = new RegExp(`<meta[^>]*(?:name|property)=["']${key}["'][^>]*content=["']([^"']*)["']`, 'i');
|
||||
const re2 = new RegExp(`<meta[^>]*content=["']([^"']*)["'][^>]*(?:name|property)=["']${key}["']`, 'i');
|
||||
@@ -308,13 +275,16 @@ function extractTitle(html) {
|
||||
}
|
||||
|
||||
async function scrapeLight(url) {
|
||||
log(`Scraping léger: ${url}`);
|
||||
const html = await fetchCapped(url);
|
||||
log(`Scraping léger: ${hoteDuLien(url) || 'adresse illisible'}`);
|
||||
const { html, urlFinale, chaine } = await recupererPage(url);
|
||||
return {
|
||||
title: extractTitle(html),
|
||||
metaDescription: extractMeta(html, 'description'),
|
||||
og: extractOgTags(html),
|
||||
text: extractVisibleText(html),
|
||||
// Lot 15 : de quoi remplir la table de redirections de R6 (et la reprise après coupure).
|
||||
url_finale: urlFinale,
|
||||
redirections: chaine,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,179 @@
|
||||
/**
|
||||
* Récupération d'une page soumise, gardée contre les adresses internes (lot 15, 21/11/2026).
|
||||
*
|
||||
* Avant ce lot, le worker faisait `fetch(url, { redirect: 'follow' })` sur toute adresse soumise,
|
||||
* depuis le VPS : une adresse comme http://localhost:8070 (NocoDB) ou une redirection vers
|
||||
* 127.0.0.1 faisait lire au worker un service interne, dont le contenu partait dans
|
||||
* `scrape_content` et chez le fournisseur du modèle.
|
||||
*
|
||||
* Règle : avant l'appel ET après chaque redirection (suivie à la main, au plus MAX_SAUTS),
|
||||
* - schéma http ou https seulement ;
|
||||
* - port par défaut seulement (80, 443) : un port explicite vers l'IP publique du VPS
|
||||
* atteindrait ses services locaux par la boucle de l'hôte ;
|
||||
* - ni identifiants dans l'adresse, ni nom d'hôte local (localhost, *.localhost, *.local,
|
||||
* *.internal, *.lan, *.home.arpa, nom sans point) ;
|
||||
* - toutes les adresses IP que le nom résout sont publiques (ni boucle locale, ni plage
|
||||
* privée, ni lien local, ni CGNAT, ni multicast, ni réservée ; IPv4 dans IPv6 comprise).
|
||||
*
|
||||
* Limite connue (dite au RECAP) : le fetch natif de Node refait sa propre résolution DNS ;
|
||||
* un nom qui change de réponse entre notre vérification et la connexion (rebinding) n'est pas
|
||||
* couvert. Le fermer demande un agent HTTP à résolution épinglée (undici), hors de ce lot.
|
||||
*
|
||||
* `recupererPage(url, { fetch, lookup })` : les deux dépendances s'injectent pour les tests.
|
||||
*/
|
||||
|
||||
import { BlockList, isIP } from 'node:net';
|
||||
import { lookup as dnsLookup } from 'node:dns/promises';
|
||||
|
||||
export const TIMEOUT_MS = 8_000;
|
||||
export const MAX_OCTETS = 500_000;
|
||||
export const MAX_SAUTS = 5;
|
||||
const USER_AGENT = 'AEP/2.0 contact@trans-former.fr';
|
||||
|
||||
const interdites = new BlockList();
|
||||
for (const [reseau, prefixe] of [
|
||||
['0.0.0.0', 8], ['10.0.0.0', 8], ['100.64.0.0', 10], ['127.0.0.0', 8], ['169.254.0.0', 16],
|
||||
['172.16.0.0', 12], ['192.0.0.0', 24], ['192.0.2.0', 24], ['192.88.99.0', 24], ['192.168.0.0', 16],
|
||||
['198.18.0.0', 15], ['198.51.100.0', 24], ['203.0.113.0', 24], ['224.0.0.0', 4], ['240.0.0.0', 4],
|
||||
]) interdites.addSubnet(reseau, prefixe, 'ipv4');
|
||||
for (const [reseau, prefixe] of [
|
||||
['::', 128], ['::1', 128], ['100::', 64], ['2001:db8::', 32], ['fc00::', 7], ['fe80::', 10],
|
||||
['fec0::', 10], ['ff00::', 8],
|
||||
]) interdites.addSubnet(reseau, prefixe, 'ipv6');
|
||||
|
||||
/** Une IPv4 logée dans une IPv6 (::ffff:a.b.c.d, ::a.b.c.d, 64:ff9b::a.b.c.d, 2002:aabb:ccdd::) → l'IPv4, sinon null. */
|
||||
function ipv4Logee(ip6) {
|
||||
const s = ip6.toLowerCase();
|
||||
const pointee = s.match(/^(?:::ffff:|::|64:ff9b::)(\d+\.\d+\.\d+\.\d+)$/);
|
||||
if (pointee) return pointee[1];
|
||||
const hexa = s.match(/^(?:::ffff:|64:ff9b::)([0-9a-f]{1,4}):([0-9a-f]{1,4})$/);
|
||||
const six2quatre = s.match(/^2002:([0-9a-f]{1,4}):([0-9a-f]{1,4})(?::|$)/);
|
||||
const m = hexa || six2quatre;
|
||||
if (!m) return null;
|
||||
const [h, l] = [parseInt(m[1], 16), parseInt(m[2], 16)];
|
||||
return `${h >> 8}.${h & 255}.${l >> 8}.${l & 255}`;
|
||||
}
|
||||
|
||||
/** true si l'adresse IP (texte) n'est pas joignable sur l'Internet public. */
|
||||
export function ipInterne(ip) {
|
||||
const famille = isIP(ip);
|
||||
if (famille === 4) return interdites.check(ip, 'ipv4');
|
||||
if (famille === 6) {
|
||||
const v4 = ipv4Logee(ip);
|
||||
if (v4) return interdites.check(v4, 'ipv4');
|
||||
return interdites.check(ip, 'ipv6');
|
||||
}
|
||||
return true; // illisible : refusée
|
||||
}
|
||||
|
||||
const HOTES_LOCAUX = /(^|\.)(localhost|local|internal|intranet|lan|home\.arpa|localdomain)$/i;
|
||||
|
||||
/**
|
||||
* Contrôle d'une adresse sans réseau : schéma, port, identifiants, nom d'hôte, IP littérale.
|
||||
* @returns {{ ok: true, url: URL, hote: string, ip: boolean } | { ok: false, motif: string }}
|
||||
*/
|
||||
export function controlerAdresse(brute) {
|
||||
let url;
|
||||
try {
|
||||
url = new URL(String(brute));
|
||||
} catch {
|
||||
return { ok: false, motif: 'adresse illisible' };
|
||||
}
|
||||
if (url.protocol !== 'http:' && url.protocol !== 'https:') return { ok: false, motif: `schéma ${url.protocol} refusé` };
|
||||
if (url.username || url.password) return { ok: false, motif: 'identifiants dans l’adresse refusés' };
|
||||
if (url.port) return { ok: false, motif: `port explicite ${url.port} refusé` };
|
||||
const hote = url.hostname.replace(/^\[|\]$/g, '').replace(/\.$/, '');
|
||||
if (!hote) return { ok: false, motif: 'hôte absent' };
|
||||
if (isIP(hote)) {
|
||||
return ipInterne(hote) ? { ok: false, motif: 'adresse IP interne refusée' } : { ok: true, url, hote, ip: true };
|
||||
}
|
||||
if (!hote.includes('.') || HOTES_LOCAUX.test(hote)) return { ok: false, motif: 'nom d’hôte local refusé' };
|
||||
return { ok: true, url, hote, ip: false };
|
||||
}
|
||||
|
||||
/** Contrôle complet : celui de `controlerAdresse`, puis toutes les IP que le nom résout. */
|
||||
export async function verifierAdresse(brute, { lookup = dnsLookup } = {}) {
|
||||
const c = controlerAdresse(brute);
|
||||
if (!c.ok || c.ip) return c;
|
||||
let adresses;
|
||||
try {
|
||||
adresses = await lookup(c.hote, { all: true, verbatim: true });
|
||||
} catch (e) {
|
||||
return { ok: false, motif: `résolution impossible (${e.code || e.message})` };
|
||||
}
|
||||
if (!adresses?.length) return { ok: false, motif: 'aucune adresse résolue' };
|
||||
if (adresses.some(a => ipInterne(a.address))) return { ok: false, motif: 'le nom résout vers une adresse interne' };
|
||||
return c;
|
||||
}
|
||||
|
||||
export class AdresseRefusee extends Error {
|
||||
constructor(motif, url) {
|
||||
super(`adresse refusée : ${motif}`);
|
||||
this.name = 'AdresseRefusee';
|
||||
this.motif = motif;
|
||||
this.url = url;
|
||||
}
|
||||
}
|
||||
|
||||
async function lireCorps(res) {
|
||||
const reader = res.body?.getReader();
|
||||
if (!reader) return (await res.text()).slice(0, MAX_OCTETS);
|
||||
const morceaux = [];
|
||||
let total = 0;
|
||||
while (true) {
|
||||
const { done, value } = await reader.read();
|
||||
if (done) break;
|
||||
morceaux.push(value);
|
||||
total += value.length;
|
||||
if (total >= MAX_OCTETS) {
|
||||
await reader.cancel().catch(() => {});
|
||||
break;
|
||||
}
|
||||
}
|
||||
return Buffer.concat(morceaux.map(m => Buffer.from(m))).subarray(0, MAX_OCTETS).toString('utf-8');
|
||||
}
|
||||
|
||||
/**
|
||||
* Récupère une page, redirections suivies à la main et contrôlées une à une.
|
||||
* @returns {Promise<{ html: string, urlFinale: string, chaine: string[] }>}
|
||||
* chaine : l'adresse soumise puis chaque adresse de redirection, dans l'ordre (de quoi remplir
|
||||
* la table de redirections de normaliserUrl).
|
||||
* @throws {AdresseRefusee} si une adresse de la chaîne est refusée ; Error sinon (HTTP, délai…).
|
||||
*/
|
||||
export async function recupererPage(urlSoumise, { fetch: fetchFn = globalThis.fetch, lookup = dnsLookup, timeoutMs = TIMEOUT_MS } = {}) {
|
||||
const controleur = new AbortController();
|
||||
const minuterie = setTimeout(() => controleur.abort(), timeoutMs);
|
||||
const chaine = [];
|
||||
try {
|
||||
let courante = String(urlSoumise);
|
||||
for (let saut = 0; ; saut++) {
|
||||
const v = await verifierAdresse(courante, { lookup });
|
||||
if (!v.ok) throw new AdresseRefusee(v.motif, courante);
|
||||
chaine.push(v.url.href);
|
||||
const res = await fetchFn(v.url.href, {
|
||||
signal: controleur.signal,
|
||||
redirect: 'manual',
|
||||
headers: { 'User-Agent': USER_AGENT },
|
||||
});
|
||||
if (res.status >= 300 && res.status < 400) {
|
||||
const location = res.headers.get('location');
|
||||
try { await res.body?.cancel(); } catch { /* corps déjà fermé */ }
|
||||
if (!location) throw new Error(`HTTP ${res.status} sans Location`);
|
||||
if (saut + 1 > MAX_SAUTS) throw new Error(`plus de ${MAX_SAUTS} redirections`);
|
||||
courante = new URL(location, v.url).href;
|
||||
continue;
|
||||
}
|
||||
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
||||
return { html: await lireCorps(res), urlFinale: v.url.href, chaine };
|
||||
}
|
||||
} finally {
|
||||
clearTimeout(minuterie);
|
||||
}
|
||||
}
|
||||
|
||||
/** Chaîne de redirections → table { source: cible } pour normaliserUrl (un saut par paire). */
|
||||
export function tableRedirections(chaine = []) {
|
||||
const table = {};
|
||||
for (let i = 0; i + 1 < chaine.length; i++) table[chaine[i]] = chaine[i + 1];
|
||||
return table;
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
/**
|
||||
* Lot 15 — la récupération de page refuse les adresses internes, avant l'appel et après
|
||||
* chaque redirection. Aucun réseau : fetch et la résolution DNS sont simulés.
|
||||
*/
|
||||
import { describe, it } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { recupererPage, controlerAdresse, verifierAdresse, ipInterne, tableRedirections, AdresseRefusee, MAX_SAUTS } from '../lib/recupererPage.js';
|
||||
|
||||
/** Résolution simulée : nom → liste d'IP ; tout nom absent lève ENOTFOUND. */
|
||||
const dns = table => async (nom) => {
|
||||
if (!(nom in table)) throw Object.assign(new Error('introuvable'), { code: 'ENOTFOUND' });
|
||||
return table[nom].map(address => ({ address, family: address.includes(':') ? 6 : 4 }));
|
||||
};
|
||||
|
||||
/** fetch simulé : adresse → { status, location?, body? } ; garde la trace des appels. */
|
||||
function faux(routes) {
|
||||
const appels = [];
|
||||
const fn = async (url, opts) => {
|
||||
appels.push({ url, redirect: opts?.redirect });
|
||||
const r = routes[url];
|
||||
if (!r) throw new Error(`appel inattendu à ${url}`);
|
||||
return new Response(r.body ?? '', { status: r.status ?? 200, headers: r.location ? { location: r.location } : {} });
|
||||
};
|
||||
fn.appels = appels;
|
||||
return fn;
|
||||
}
|
||||
|
||||
const PUBLIC = { 'exemple.org': ['93.184.215.14'], 'www.exemple.org': ['93.184.215.14'], 'ailleurs.net': ['2606:4700::6810:84e5'] };
|
||||
|
||||
describe('lot 15 · filtre d’hôte (adresses internes refusées)', () => {
|
||||
it('IP internes refusées : boucle, privées, lien local, CGNAT, multicast, IPv4 dans IPv6', () => {
|
||||
for (const ip of ['127.0.0.1', '127.8.8.8', '10.1.2.3', '172.16.0.1', '172.31.255.255', '192.168.1.1', '169.254.169.254',
|
||||
'100.64.0.1', '0.0.0.0', '224.0.0.1', '255.255.255.255', '::1', '::', 'fe80::1', 'fc00::1', 'fd12:3456::1',
|
||||
'::ffff:127.0.0.1', '::ffff:7f00:1', '::ffff:a00:1', '64:ff9b::a9fe:a9fe', '2002:c0a8:101::1', 'ff02::1', 'pas-une-ip']) {
|
||||
assert.equal(ipInterne(ip), true, ip);
|
||||
}
|
||||
for (const ip of ['93.184.215.14', '1.1.1.1', '172.32.0.1', '2606:4700::6810:84e5', '::ffff:5db8:d70e']) {
|
||||
assert.equal(ipInterne(ip), false, ip);
|
||||
}
|
||||
});
|
||||
|
||||
it('adresses refusées sans réseau : schéma, port, identifiants, nom local, IP littérale', () => {
|
||||
for (const a of ['file:///etc/passwd', 'ftp://exemple.org', 'gopher://exemple.org', 'javascript:alert(1)', 'data:text/html,x',
|
||||
'http://localhost/', 'http://LOCALHOST./', 'http://api.localhost/', 'http://nas.local/', 'http://db.internal/', 'http://intranet/',
|
||||
'http://127.0.0.1/', 'http://2130706433/', 'http://0x7f.1/', 'http://[::1]/', 'http://[::ffff:127.0.0.1]/', 'http://169.254.169.254/latest/meta-data',
|
||||
'http://exemple.org:8070/', 'https://exemple.org:8443/', 'http://user:mdp@exemple.org/', 'pas une adresse']) {
|
||||
assert.equal(controlerAdresse(a).ok, false, a);
|
||||
}
|
||||
assert.equal(controlerAdresse('https://exemple.org/page?x=1').ok, true);
|
||||
assert.equal(controlerAdresse('http://exemple.org:80/').ok, true, 'le port par défaut est retiré par URL');
|
||||
assert.equal(controlerAdresse('https://93.184.215.14/').ok, true);
|
||||
});
|
||||
|
||||
it('un nom public qui résout vers une IP interne est refusé (une seule IP interne suffit)', async () => {
|
||||
const lookup = dns({ 'piege.exemple.org': ['93.184.215.14', '127.0.0.1'], 'nocodb.exemple.org': ['10.0.0.5'], ...PUBLIC });
|
||||
assert.equal((await verifierAdresse('https://piege.exemple.org/', { lookup })).ok, false);
|
||||
assert.equal((await verifierAdresse('https://nocodb.exemple.org/', { lookup })).ok, false);
|
||||
assert.equal((await verifierAdresse('https://inconnu.exemple.org/', { lookup })).ok, false, 'non résolu : refusé');
|
||||
assert.equal((await verifierAdresse('https://ailleurs.net/', { lookup })).ok, true);
|
||||
});
|
||||
|
||||
it('aucune requête n’est faite vers une adresse refusée', async () => {
|
||||
const fetch = faux({});
|
||||
await assert.rejects(recupererPage('http://localhost:8070/api/v1/db', { fetch, lookup: dns(PUBLIC) }), AdresseRefusee);
|
||||
await assert.rejects(recupererPage('http://127.0.0.1/', { fetch, lookup: dns(PUBLIC) }), AdresseRefusee);
|
||||
assert.equal(fetch.appels.length, 0);
|
||||
});
|
||||
|
||||
it('redirection vers une adresse interne : refusée après le saut, la cible n’est jamais appelée', async () => {
|
||||
const fetch = faux({
|
||||
'https://exemple.org/': { status: 302, location: 'http://127.0.0.1:8070/api/v1/db/meta' },
|
||||
'https://www.exemple.org/': { status: 301, location: '/suite' },
|
||||
'https://www.exemple.org/suite': { status: 302, location: 'http://169.254.169.254/latest/meta-data' },
|
||||
});
|
||||
await assert.rejects(recupererPage('https://exemple.org/', { fetch, lookup: dns(PUBLIC) }), e => e instanceof AdresseRefusee && /port|interne/.test(e.motif));
|
||||
await assert.rejects(recupererPage('https://www.exemple.org/', { fetch, lookup: dns(PUBLIC) }), AdresseRefusee);
|
||||
assert.deepEqual(fetch.appels.map(a => a.url), ['https://exemple.org/', 'https://www.exemple.org/', 'https://www.exemple.org/suite']);
|
||||
assert.ok(fetch.appels.every(a => a.redirect === 'manual'), 'jamais redirect: follow');
|
||||
});
|
||||
|
||||
it('redirection vers un nom qui résout en interne : refusée', async () => {
|
||||
const fetch = faux({ 'https://exemple.org/': { status: 307, location: 'https://rebond.exemple.org/' } });
|
||||
const lookup = dns({ ...PUBLIC, 'rebond.exemple.org': ['192.168.0.10'] });
|
||||
await assert.rejects(recupererPage('https://exemple.org/', { fetch, lookup }), AdresseRefusee);
|
||||
assert.equal(fetch.appels.length, 1);
|
||||
});
|
||||
|
||||
it('redirections publiques suivies : adresse finale et chaîne rendues, table de redirections tirée', async () => {
|
||||
const fetch = faux({
|
||||
'http://exemple.org/': { status: 301, location: 'https://www.exemple.org/' },
|
||||
'https://www.exemple.org/': { status: 302, location: '/accueil' },
|
||||
'https://www.exemple.org/accueil': { status: 200, body: '<title>Accueil</title>' },
|
||||
});
|
||||
const r = await recupererPage('http://exemple.org', { fetch, lookup: dns(PUBLIC) });
|
||||
assert.equal(r.urlFinale, 'https://www.exemple.org/accueil');
|
||||
assert.deepEqual(r.chaine, ['http://exemple.org/', 'https://www.exemple.org/', 'https://www.exemple.org/accueil']);
|
||||
assert.match(r.html, /Accueil/);
|
||||
assert.deepEqual(tableRedirections(r.chaine), {
|
||||
'http://exemple.org/': 'https://www.exemple.org/',
|
||||
'https://www.exemple.org/': 'https://www.exemple.org/accueil',
|
||||
});
|
||||
});
|
||||
|
||||
it(`au plus ${MAX_SAUTS} redirections, puis erreur`, async () => {
|
||||
const routes = {};
|
||||
for (let i = 0; i <= MAX_SAUTS + 1; i++) routes[`https://exemple.org/${i}`] = { status: 302, location: `/${i + 1}` };
|
||||
await assert.rejects(recupererPage('https://exemple.org/0', { fetch: faux(routes), lookup: dns(PUBLIC) }), /redirections/);
|
||||
});
|
||||
|
||||
it('le corps est plafonné à 500 Ko', async () => {
|
||||
const fetch = faux({ 'https://exemple.org/': { status: 200, body: 'a'.repeat(600_000) } });
|
||||
const r = await recupererPage('https://exemple.org/', { fetch, lookup: dns(PUBLIC) });
|
||||
assert.equal(r.html.length, 500_000);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user