Skip to content

Commit b86fdd0

Browse files
authored
Switch to undici Agent for HTTPS requests
Replace https.Agent with undici's Agent for handling self-signed certificates.
1 parent 37a8b11 commit b86fdd0

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

modules/default/calendar/calendarfetcher.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
const https = require("node:https");
21
const ical = require("node-ical");
32
const Log = require("logger");
43
const CalendarFetcherUtils = require("./calendarfetcherutils");
54
const { getUserAgent } = require("#server_functions");
5+
const { Agent } = require('undici');
66

77
const FIFTEEN_MINUTES = 15 * 60 * 1000;
88
const THIRTY_MINUTES = 30 * 60 * 1000;
@@ -74,8 +74,12 @@ class CalendarFetcher {
7474
const options = { headers };
7575

7676
if (this.selfSignedCert) {
77-
options.agent = new https.Agent({ rejectUnauthorized: false });
78-
}
77+
options.dispatcher = new Agent({
78+
connect: {
79+
rejectUnauthorized: false
80+
}
81+
});
82+
}
7983

8084
if (this.auth) {
8185
if (this.auth.method === "bearer") {

0 commit comments

Comments
 (0)