Skip to content

Commit

Permalink
http2: fix hanging of Http2ServerResponse's end method with no data
Browse files Browse the repository at this point in the history
  • Loading branch information
pd4d10 committed May 5, 2021
1 parent 26e318a commit ccf4ee4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/internal/http2/compat.js
Original file line number Diff line number Diff line change
Expand Up @@ -757,9 +757,6 @@ class Http2ServerResponse extends Stream {
if (chunk !== null && chunk !== undefined)
this.write(chunk, encoding);

state.headRequest = stream.headRequest;
state.ending = true;

if (typeof cb === 'function') {
if (stream.writableEnded)
this.once('finish', cb);
Expand All @@ -770,6 +767,9 @@ class Http2ServerResponse extends Stream {
if (!stream.headersSent)
this.writeHead(this[kState].statusCode);

state.headRequest = stream.headRequest;
state.ending = true;

if (this[kState].closed || stream.destroyed)
ReflectApply(onStreamCloseResponse, stream, []);
else
Expand Down

0 comments on commit ccf4ee4

Please sign in to comment.