我尝试将'transfer-encoding:chunked‘头返回到一个大的下载,但响应终止于"31.9M“,这非常接近文档中的"32MB”限制。
Unofficial FAQ声明分块编码现在是可能的,但我似乎不能让它工作。
是否必须翻转任何标志(例如https/2)才能启用流?是不是只有部分地区有可能?(我正在使用europe-west1)
发布于 2021-05-17 18:33:28
以下最小情况实际上是在Cloud Run上流式传输45MB,没有任何特殊配置,在us-cental1和europe-west1中得到确认
FROM node:14-slim
COPY index.js index.js
CMD [ "node", "index.js" ]const http = require('http');
http.createServer((request, response) => {
response.setHeader('Transfer-Encoding', 'chunked');
// 45MB
var i = 1000000;
function nextChunk() {
return new Promise(resolve => {
if (i-- > 0) {
response.write(
'123456781234567812345678123456781234567812345678',
() => nextChunk()
);
} else {
response.end();
}
})
};
Promise.all(nextChunk())
}).listen(process.env.PORT || 8080);https://stackoverflow.com/questions/67566464
复制相似问题