spdy-http2 / node-spdy

SPDY server on Node.js
2.81k stars 196 forks source link

`res.finished` doesn't work when using h2 protocol #276

Closed SpaceK33z closed 7 years ago

SpaceK33z commented 7 years ago

I've found an interesting issue. When using the h2 protocol, res.finished always returns false. Using http/1.1 as a protocol, this does work correctly.

Some sample code to reproduce:

var options = {
    spdy: {
        protocols: ['h2'],
        // Replace with this to see correct value:
        // protocols: ['http/1.1'],
    },
};

var server = spdy.createServer(options, function(req, res) {
    res.writeHead(200);
    res.end('hello world!');
    console.log('res finished:', res.finished);
});

server.listen(8080);

In this example, I would expect that the console outputs: res finished: true.

I wanted to try spdy with the sockjs-node package, but that doesn't work because of this issue. Took me a few hours to discover the root cause :).

Also see Node.js documentation about this.

indutny commented 7 years ago

Fixed, sorry!

SpaceK33z commented 7 years ago

Wow thanks for the quick fix!