Skip to content

http2: stream.pushStream callback signature changed in v8.11.2 #20773

Closed
@watson

Description

@watson
  • Version: v8.11.2
  • Platform: Darwin
  • Subsystem: http2

The callback signature given to steam.pushStream() used to be function (stream, headers) {} in Node.js ^8.4.0. This was changed to function (err, stream, headers) {} in Node.js 9.

It seems that with the new release of v8.11.2 the new signature from Node.js 9 have made its way back to Node.js 8, which breaks all apps that's using it.

I'm still investigating the details and will follow up in this issue as I learn more.

Test program
const http2 = require('http2')

const server = http2.createServer()

server.on('stream', function (stream, headers) {
  stream.pushStream({':path': '/pushed'}, (stream, headers) => {
    stream.respond({
      'content-type': 'text/plain',
      ':status': 200
    })
    stream.end('some pushed data')
  })

  stream.respond({
    'content-type': 'text/plain',
    ':status': 200
  })
  stream.end('foo')
})

server.listen(() => {
  const client = http2.connect('http://localhost:' + server.address().port)

  client.on('stream', (stream, headers, flags) => {
    process.exit()
  })

  client.request({':path': '/'}).end()
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    http2Issues or PRs related to the http2 subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions