-
-
Notifications
You must be signed in to change notification settings - Fork 169
Description
When piping audio files from S3 through Meteor-Files with interceptDownload()
and serve()
the server crashed on some files with ERR_HTTP_TRAILER_INVALID
from https://github.com/nodejs/node/blob/d01a06a916efd30844e1e0a38e79dc0054fc4451/lib/_http_outgoing.js#L458-L460 (tested on node 12.6.1
).
I think the reason for this is that on Status code 206
both Content-Range
and Transfer-Encoding
are set, and if I am not mistaken they conflict. If I understand the specs correctly those are not allowed to be used together:
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests#Comparison_to_chunked_Transfer-Encoding
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Trailer
case '206':
headers.Pragma = 'private';
headers.Trailer = 'expires';
headers['Transfer-Encoding'] = 'chunked';
break;
https://github.com/VeliovGroup/Meteor-Files/blob/master/server.js#L242-L246
if (!http.response.headersSent) {
http.response.setHeader('Content-Range', `bytes ${reqRange.start}-${reqRange.end}/${vRef.size}`);
}
https://github.com/VeliovGroup/Meteor-Files/blob/master/server.js#L1840
My knowledge of HTTP headers is limited, hopefully, this gives you some clues @dr-dimitru .
My current workaround is to pass my own responseHeaders()
without the case 206
part.