diff --git a/lib/protocol/stream.js b/lib/protocol/stream.js index c42de87a..2d1f16a8 100644 --- a/lib/protocol/stream.js +++ b/lib/protocol/stream.js @@ -567,8 +567,9 @@ Stream.prototype._transition = function transition(sending, frame) { // can be used to close any of those streams. case 'CLOSED': if (PRIORITY || (sending && RST_STREAM) || + (receiving && WINDOW_UPDATE) || (receiving && this._closedByUs && - (this._closedWithRst || WINDOW_UPDATE || RST_STREAM || ALTSVC))) { + (this._closedWithRst || RST_STREAM || ALTSVC))) { /* No state change */ } else { streamError = 'STREAM_CLOSED'; diff --git a/test/stream.js b/test/stream.js index 87af55fc..90e0ef64 100644 --- a/test/stream.js +++ b/test/stream.js @@ -192,7 +192,7 @@ describe('stream.js', function() { stream.headers({}); stream.end(); stream.upstream.write({ type: 'HEADERS', headers:{}, flags: { END_STREAM: true }, count_change: util.noop }); - example_frames.slice(1).forEach(function(invalid_frame) { + example_frames.slice(2).forEach(function(invalid_frame) { invalid_frame.count_change = util.noop; expect(stream._transition.bind(stream, false, invalid_frame)).to.throw('Uncaught, unspecified "error" event.'); });