From 3f7af8acfb12b4144a1080a823568ddfc848efc6 Mon Sep 17 00:00:00 2001 From: Michael Vincent Date: Wed, 5 Feb 2025 23:12:58 -0600 Subject: [PATCH] Add Accept-Encoding header to getPodcastFeed() This commit adds the Accept-Encoding header to getPodcastFeed() with gzip, compress, and deflate support. This allows servers to send a compressed response that'll be decompressed by axios transparently. Audiobookshelf is currently using axios v0.27.2, which enables the decompress option by default. The decompress feature supports gzip, compress, and deflate algorithms (see axios/lib/adapters/http.js). axios v0.27.2 does not add the Accept-Encoding header to requests automatically, so that's the responsibility of the caller. --- server/utils/podcastUtils.js | 1 + 1 file changed, 1 insertion(+) diff --git a/server/utils/podcastUtils.js b/server/utils/podcastUtils.js index d6983047..485fccfb 100644 --- a/server/utils/podcastUtils.js +++ b/server/utils/podcastUtils.js @@ -311,6 +311,7 @@ module.exports.getPodcastFeed = (feedUrl, excludeEpisodeMetadata = false) => { responseType: 'arraybuffer', headers: { Accept: 'application/rss+xml, application/xhtml+xml, application/xml, */*;q=0.8', + 'Accept-Encoding': 'gzip, compress, deflate', 'User-Agent': userAgent }, httpAgent: global.DisableSsrfRequestFilter?.(feedUrl) ? null : ssrfFilter(feedUrl),