Skip to content

best way to save what you love

stream/internal: also copy content-length where applicable

dumbmoron3d3a717f3ef5
diff --git a/src/modules/stream/internal.js b/src/modules/stream/internal.js
index 449be22e..db39fb05 100644
--- a/src/modules/stream/internal.js
+++ b/src/modules/stream/internal.js
@@ -58,7 +58,11 @@ async function handleYoutubeStream(streamInfo, res) {
const stream = chunkedStream(streamInfo, size);
- res.setHeader('content-type', req.headers.get('content-type'));
+ for (const headerName of ['content-type', 'content-length']) {
+ const headerValue = req.headers.get(headerName);
+ if (headerValue) res.setHeader(headerName, headerValue);
+ }
+
stream.pipe(res);
stream.on('error', () => res.destroy());
} catch {