Open houfeng0923 opened 5 years ago
I've encountered a similar issue. I'm using spdy through redbird. Big response body is sometimes truncated but only in Firefox.
Server:
'use strict';
const fs = require('fs');
const http = require('spdy');
let data = [];
for (let i = 0; i < 1000000; ++i)
{
data.push(Math.random());
}
data = JSON.stringify(data);
const server = http.createServer({
key: fs.readFileSync(`./config/development/ssl/privkey.pem`, 'utf8'),
cert: fs.readFileSync(`./config/development/ssl/fullchain.pem`, 'utf8')
});
server.listen(8443);
server.on('request', (req, res) =>
{
console.log('>>>');
console.log(`${req.method} ${req.url}`);
console.log(req.headers);
res.setHeader('Content-Type', 'application/json; charset=utf-8');
res.setHeader('Access-Control-Allow-Origin', '*');
res.setHeader('Access-Control-Allow-Methods', 'GET');
res.setHeader('Access-Control-Allow-Headers', req.headers['access-control-request-headers'] || '');
if (req.method === 'GET')
{
res.setHeader('Content-Length', data.length.toString());
res.writeHead(200);
res.end(data);
}
else
{
res.writeHead(200);
res.end();
}
});
curl 7.65.1 works everytime:
curl https://dev.wmes.pl:8443/ --http2-prior-knowledge > test.json
Chrome 74.0.3729.169 works everytime:
fetch('https://dev.wmes.pl:8443/')
.then(res => res.json())
.then(() => console.log('DONE!'));
The above fetch fails often in Firefox 68.0b10.
Firefox seems to be always working if spdy is replaced with nginx (with http2 enabled).
DEBUG=spdy:*
logs: spdy-http2-debug-logs.zip
I have a similar issue: I request a (large) javascript file and by the end it is completely garbled.
Around 4/5ths of the file I start seeing this:
And by the end it is completely unrecognizable:
I downgraded tot 3.4.7 and the problem was fixed.
i found a problem in webpack-dev-server(use express and spdy ) ,when the protocal is http2, some big json response is truncated . it not happen when use http1.1 .
so i made a test code for proxy server based on express and spay :
the truncated response like below:
now, i am not sure the reason in spdy or proxy . maybe it has related to chimurai/http-proxy-middleware#79