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:
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.
When piping audio files from S3 through Meteor-Files with
interceptDownload()andserve()the server crashed on some files withERR_HTTP_TRAILER_INVALIDfrom https://github.com/nodejs/node/blob/d01a06a916efd30844e1e0a38e79dc0054fc4451/lib/_http_outgoing.js#L458-L460 (tested on node12.6.1).I think the reason for this is that on Status code
206bothContent-RangeandTransfer-Encodingare set, and if I am not mistaken they conflict. If I understand the specs correctly those are not allowed to be used together:https://github.com/VeliovGroup/Meteor-Files/blob/master/server.js#L242-L246
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 thecase 206part.