Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http2: make http2/compat.write more http/1 compliant #30964

Closed
wants to merge 4 commits into from

Conversation

@ronag
Copy link
Member

ronag commented Dec 14, 2019

HTTP2ServerResponse.write would behave differently than both http1 and streams. This PR makes it more compliant with stream.Writable behaviour.

In particular, prior to this PR, write would throw err instead of calling destroy(err)

Refs: #29529

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
@ronag

This comment has been minimized.

Copy link
Member Author

ronag commented Dec 14, 2019

Would be nice to eventually consolidate stream, http1, http/2 compat and http/2 in terms of the streams API & behaviours.

@ronag

This comment was marked as outdated.

Copy link
Member Author

ronag commented Dec 14, 2019

@jasnell I also notice now that HTTP2ServerResponse never emits 'error' nor does it listen to the 'error' handler on the underlying stream. :/

EDIT: neither does http1

@ronag ronag force-pushed the nxtedition:http2-compat-writable branch from 69f9a1d to dac542b Dec 14, 2019
@ronag

This comment has been minimized.

Copy link
Member Author

ronag commented Dec 14, 2019

Unsure about semver. Maybe major?

@ronag ronag changed the title http2: make HTTP2ServerResponse more streams compliant http2: make HTTP2ServerResponse.write more streams compliant Dec 14, 2019
Copy link
Member

addaleax left a comment

I’m good with semver-patch

@nodejs-github-bot

This comment has been minimized.

Copy link
Member

apapirovski left a comment

I don't think ERR_STREAM_DESTROYED belongs here. Also left some nits but that's the primary objection for me.

Would also like James to review ideally.

lib/internal/http2/compat.js Outdated Show resolved Hide resolved
lib/internal/http2/compat.js Outdated Show resolved Hide resolved
lib/internal/http2/compat.js Outdated Show resolved Hide resolved
@ronag

This comment has been minimized.

Copy link
Member Author

ronag commented Dec 14, 2019

@apapirovski: I think you prefer to align with http1 instead of streams. I've updated the PR accordingly.

@ronag ronag force-pushed the nxtedition:http2-compat-writable branch from d1a706e to 1ef5224 Dec 14, 2019
this.destroy(err);
return;
return false;
} else if (this[kState].closed) {

This comment has been minimized.

Copy link
@apapirovski

apapirovski Dec 14, 2019

Member

My other outstanding question regarding closed stands. Might be good to get @jasnell @addaleax to weigh in too. Seems like this existing error is not in the spirit of compatibility which could cause people issues...

(Could also be left for a separate PR.)

This comment has been minimized.

Copy link
@apapirovski

apapirovski Dec 14, 2019

Member

(It was mentioned in the linked issue, hence me bringing it up.)

This comment has been minimized.

Copy link
@ronag

ronag Dec 14, 2019

Author Member

I'll leave this as is until there is more input.

This comment has been minimized.

Copy link
@ronag

ronag Dec 14, 2019

Author Member

I think the biggest issue was the throw.

@ronag ronag force-pushed the nxtedition:http2-compat-writable branch from c8c1f00 to 19c30e7 Dec 14, 2019
@apapirovski apapirovski dismissed their stale review Dec 14, 2019

change request was addressed, will approve after outstanding discussion is resolved

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

@ronag ronag changed the title http2: make HTTP2ServerResponse.write more streams compliant http2: make http2/compat.write more http/1 compliant Dec 15, 2019
@Trott
Trott approved these changes Dec 18, 2019
@BridgeAR

This comment has been minimized.

Copy link
Member

BridgeAR commented Dec 24, 2019

I believe this is author-ready?

@BridgeAR BridgeAR requested a review from jasnell Dec 25, 2019
@BridgeAR BridgeAR removed the author ready label Dec 25, 2019
@Trott

This comment has been minimized.

Copy link
Member

Trott commented Dec 31, 2019

Needs a rebase.

ronag added 4 commits Dec 14, 2019
HTTP2ServerResponse.write would behave differently than
both http1 and streams. This PR makes it more compliant
with stream.Writable behaviour.

Refs: #29529
@ronag

This comment has been minimized.

Copy link
Member Author

ronag commented Jan 1, 2020

rebased

@ronag ronag force-pushed the nxtedition:http2-compat-writable branch from 493c71a to 9da63be Jan 1, 2020
@nodejs-github-bot

This comment has been minimized.

Copy link

nodejs-github-bot commented Jan 1, 2020

BridgeAR added a commit that referenced this pull request Jan 1, 2020
HTTP2ServerResponse.write would behave differently than
both http1 and streams. This PR makes it more compliant
with stream.Writable behaviour.

PR-URL: #30964
Refs: #29529
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
@BridgeAR

This comment has been minimized.

Copy link
Member

BridgeAR commented Jan 1, 2020

Landed in a1d307f 🎉

@BridgeAR BridgeAR closed this Jan 1, 2020
BridgeAR added a commit that referenced this pull request Jan 3, 2020
HTTP2ServerResponse.write would behave differently than
both http1 and streams. This PR makes it more compliant
with stream.Writable behaviour.

PR-URL: #30964
Refs: #29529
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
@BridgeAR BridgeAR mentioned this pull request Jan 7, 2020
@targos

This comment has been minimized.

Copy link
Member

targos commented Jan 14, 2020

This needs a backport or other previous PRs to be backported in order to land on v12.x-staging.

sxa555 added a commit to sxa555/node that referenced this pull request Jan 21, 2020
HTTP2ServerResponse.write would behave differently than
both http1 and streams. This PR makes it more compliant
with stream.Writable behaviour.

PR-URL: nodejs#30964
Refs: nodejs#29529
sxa555 added a commit to sxa555/node that referenced this pull request Jan 21, 2020
HTTP2ServerResponse.write would behave differently than
both http1 and streams. This PR makes it more compliant
with stream.Writable behaviour.

PR-URL: nodejs#30964
Refs: nodejs#29529
sxa555 added a commit to sxa555/node that referenced this pull request Jan 21, 2020
HTTP2ServerResponse.write would behave differently than
both http1 and streams. This PR makes it more compliant
with stream.Writable behaviour.

PR-URL: nodejs#30964
Refs: nodejs#29529
Backport-PR-URL: nodejs#31444
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants
You can’t perform that action at this time.