HTTP2 Push Stream always results in aborted event being fired #22851
Closed
Description
- Version: v10.9.0
- Platform: Darwin Kernel Version 17.4.0: Sun Dec 17 09:19:54 PST 2017; root:xnu-4570.41.2~1/RELEASE_X86_64 x86_64
- Subsystem: HTTP2
Code sample:
const http2 = require('http2')
const server = http2.createServer()
server.on('stream', (stream, headers) => {
stream.pushStream({ ':path': '/test' }, (err, pushStream) => {
if (err) throw err
pushStream.end('pushed some data')
})
stream.end('some data')
})
server.listen(8080, () => {
let client = http2.connect('http://localhost:8080')
let req = client.request({ ':path': '/' })
req.on('data', (data) => {
console.log(data.toString('utf8'))
})
client.on('stream', (pushedStream) => {
console.log('on stream')
pushedStream.on('aborted', () => {
console.log('aborted')
})
pushedStream.on('end', () => {
console.log('end')
})
pushedStream.on('data', (data) => {
console.log(data.toString('utf8'))
})
})
})
Output:
on stream
some data
pushed some data
end
aborted
Expectation:
aborted event is not fired
Activity