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

add proxy handler "has" for "http2.Http2ServerResponse.socket" and "http2.Http2ServerRequest.socket" #35197

Closed
wants to merge 17 commits into from

Conversation

masx200
Copy link
Contributor

@masx200 masx200 commented Sep 14, 2020

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

add proxy handler "has" for "http2.Http2ServerResponse.socket" and "http2.Http2ServerRequest.socket".

Usually check whether the connection is a secure connection using the following judgment method:

const request=new http2.Http2ServerRequest(stream, headers, options, rawHeaders)
//true
assert(true===request.socket.encrypted)

//false
assert("encrypted" in request.socket)

@masx200 masx200 requested review from a team as code owners September 14, 2020 22:43
@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/http2
  • @nodejs/net

@nodejs-github-bot nodejs-github-bot added the http2 Issues or PRs related to the http2 subsystem. label Sep 14, 2020
@masx200 masx200 changed the title add proxy handler "has" for http2.Http2ServerResponse.socket add proxy handler "has" for "http2.Http2ServerResponse.socket" and "http2.Http2ServerRequest.socket" Sep 14, 2020
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add a unit test?

@masx200
Copy link
Contributor Author

masx200 commented Sep 14, 2020

Ok, testing is in progress

@masx200
Copy link
Contributor Author

masx200 commented Sep 15, 2020

@codebytere @Trott @schamberg97 @addaleax

Request review

@masx200 masx200 requested review from mcollina and removed request for a team September 15, 2020 05:32
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina mcollina added the request-ci Add this label to start a Jenkins CI on a PR. label Sep 15, 2020
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Sep 15, 2020
@rickyes
Copy link
Contributor

rickyes commented Sep 17, 2020

Can you fix the lint-js errors? it will make the review easier.

@Trott
Copy link
Member

Trott commented Sep 18, 2020

Can you fix the lint-js errors? it will make the review easier.

I've fixed all the lint errors in a pair of fixup commits. @rickyes PTAL

lib/internal/http2/compat.js Outdated Show resolved Hide resolved
Co-authored-by: Rich Trott <rtrott@gmail.com>
@Trott
Copy link
Member

Trott commented Sep 18, 2020

Can we name the test file something informative that describes what it does rather than test-for-pull-35197.js? It should start with test-http2- but I'm not sure what should go after that. Maybe something like test-http2-socket-proxy-handler-for-has?

Trott
Trott previously requested changes Sep 18, 2020
Copy link
Member

@Trott Trott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welcome @masx200, and thanks for the pull request! I'd like to see the name of the test file made something more in line with our other test file names, but otherwise, I think this looks good.

@masx200 masx200 requested a review from Trott September 18, 2020 16:45
@Trott Trott dismissed their stale review September 19, 2020 15:13

file was renamed

Trott
Trott previously approved these changes Sep 19, 2020
@Trott Trott dismissed their stale review September 19, 2020 15:16

LGTM but I'm going to defer to others on whether this is expected/idiomatic

Copy link
Member

@Trott Trott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course this is expected/idiomatic.

@@ -188,6 +188,11 @@ function resumeStream(stream) {
}

const proxySocketHandler = {
has(stream, prop) {
const ref = stream.session !== undefined ? stream.session[kSocket] : stream;
return (prop in stream) || (prop in ref);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional suggestion: The test file only covers one of these conditions, right? Does it make sense to add a test case so that both are covered?

@Trott Trott added the request-ci Add this label to start a Jenkins CI on a PR. label Sep 19, 2020
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Sep 19, 2020
@nodejs-github-bot
Copy link
Collaborator

@aduh95 aduh95 added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Nov 8, 2020
aduh95 pushed a commit that referenced this pull request Nov 9, 2020
PR-URL: #35197
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
@aduh95
Copy link
Contributor

aduh95 commented Nov 9, 2020

Landed in 0d2e198

@aduh95 aduh95 closed this Nov 9, 2020
danielleadams pushed a commit that referenced this pull request Nov 9, 2020
PR-URL: #35197
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
@danielleadams danielleadams mentioned this pull request Nov 9, 2020
BethGriggs pushed a commit that referenced this pull request Dec 9, 2020
PR-URL: #35197
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
BethGriggs pushed a commit that referenced this pull request Dec 10, 2020
PR-URL: #35197
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
@BethGriggs BethGriggs mentioned this pull request Dec 10, 2020
BethGriggs pushed a commit that referenced this pull request Dec 15, 2020
PR-URL: #35197
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. http2 Issues or PRs related to the http2 subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants