mirror of
https://github.com/wukko/cobalt.git
synced 2024-11-14 12:19:59 +00:00
stream/internal: also copy content-length where applicable
This commit is contained in:
parent
6eb4af125b
commit
3d3a717f3e
1 changed files with 5 additions and 1 deletions
|
@ -58,7 +58,11 @@ async function handleYoutubeStream(streamInfo, res) {
|
||||||
|
|
||||||
const stream = chunkedStream(streamInfo, size);
|
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.pipe(res);
|
||||||
stream.on('error', () => res.destroy());
|
stream.on('error', () => res.destroy());
|
||||||
} catch {
|
} catch {
|
||||||
|
|
Loading…
Reference in a new issue