-
Notifications
You must be signed in to change notification settings - Fork 187
Closed
Labels
Description
I have tried a variety of ways to send a list of 21 files in a push request. But it seems that somewhere something is ending causing the server to crash
/home/alan/dev/node-http2/lib/protocol/stream.js:627
throw new Error('Sending illegal frame (' + frame.type + ') in ' + this.state + ' state.');
^
Error: Sending illegal frame (DATA) in CLOSED state.
at Stream.transition [as _transition] (/home/alan/dev/node-http2/lib/protocol/stream.js:627:13)
at Stream._pushUpstream (/home/alan/dev/node-http2/lib/protocol/stream.js:230:8)
at Stream._finishing (/home/alan/dev/node-http2/lib/protocol/stream.js:351:10)
at emitNone (events.js:67:13)
at Stream.emit (events.js:166:7)
at finishMaybe (_stream_writable.js:468:14)
at endWritable (_stream_writable.js:478:3)
at Stream.Writable.end (_stream_writable.js:443:5)
at OutgoingResponse._finish (/home/alan/dev/node-http2/lib/http.js:355:17)
at emitNone (events.js:72:20)
I go through a process which gives me an array of objects with the push url and filename in each object. My code is
if(req.url === '/' || req.url === '/index.html') {
if(res.push) {
pushlist.forEach(item=> {
var p = res.push(item.url)
p.writeHead(200);
fs.createReadStream(item.filename).pipe(p);
})
}
}
router(req,res,donewrapper);
the router(req,res,donewrapper);
goes on to server index.html via serve-static
.
without the push stuff, the server works perfectly - and single stepping through the initialisation of each of the file readstreams also seems to work. It is only later when one of the streams end (see how OutgoingResponse._finish
is at the bottom of the call stack) that this happens.
I don't know where to go next.