From 1f07c48cac3e64572308eb17e5ccb90e25ba36b0 Mon Sep 17 00:00:00 2001 From: Nulo Date: Fri, 29 Dec 2023 12:23:34 -0300 Subject: [PATCH] =?UTF-8?q?mejorar=20l=C3=B3gica=20de=20ignorar=20tls?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- downloader/network.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/downloader/network.js b/downloader/network.js index b748bb9..60d1299 100644 --- a/downloader/network.js +++ b/downloader/network.js @@ -7,7 +7,13 @@ const dispatcher = new Agent({ maxRedirections: 20, }); const ignoreTlsDispatcher = new Agent({ - connect: { timeout: 60 * 1000, rejectUnauthorized: false }, + connect: { + timeout: 60 * 1000, + rejectUnauthorized: false, + checkServerIdentity() { + return undefined; + }, + }, bodyTimeout: 15 * 60 * 1000, maxRedirections: 20, }); @@ -87,7 +93,11 @@ function getHeaders(url) { */ export async function customRequest(url) { let d = dispatcher; - if (url.hostname === "datos.agroindustria.gob.ar") { + if ( + url.hostname === "www.energia.gob.ar" || + url.hostname === "datos.agroindustria.gob.ar" || + url.hostname === "www.agroindustria.gob.ar" + ) { d = ignoreTlsDispatcher; } const res = await request(url.toString(), {