Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.3k
Fix: Invalid HTTP/2 origin set when servername is empty #39919#39934
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
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading. Please reload this page.
Conversation
Narasimha1997 commented Aug 29, 2021 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Ayase-252 commented Aug 29, 2021
Could we add a test for the issue? |
Narasimha1997 commented Aug 29, 2021
@Ayase-252 yeah that would be great. I'll look into how tests are organised in this project so I can write few cases. |
Narasimha1997 commented Aug 29, 2021
@Ayase-252 I have added test cases. |
szmarczak commented Aug 29, 2021
@Narasimha1997 Lint fails. The commit message check fails too. |
Mesteery commented Aug 29, 2021
Ayase-252 left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could also run make -j4 test to do a full check on the codebase locally. Per https://github.com/nodejs/node/blob/master/BUILDING.md#running-tests
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Narasimha1997 commented Aug 30, 2021 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
@Mesteery@szmarczak@Ayase-252 |
Ayase-252 commented Aug 30, 2021
Maybe |
74b149d to c43b614CompareUh oh!
There was an error while loading. Please reload this page.
Narasimha1997 commented Aug 31, 2021
The build on windows has failed due to some issues while fetching NASM. Can we re-run the build? Now it seems to be working fine. |
| if(options.allowHTTP1===true) | ||
| ArrayPrototypePush(options.ALPNProtocols,'http/1.1'); | ||
| if(servername!==undefined&&options.servername===undefined) | ||
| if(servername!==undefined&&!options.servername) |
lpincaAug 31, 2021 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know it makes sense for http2 but for https the empty string is used to disable the SNI extension. I wonder if the same should be done here.
cc: @nodejs/http2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Yeah that makes sense. This PR is based in what the issue poster has expected to be the intended behaviour. If you confirm SNI should be disabled, I would be happy to make these changes.
| } | ||
| functionwithServerName(){ | ||
| constsession=http2.connect('https://1.1.1.1',{servername: 'cloudflare-dns.com'}); |
lpincaAug 31, 2021 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This requires an external connection. Is it possible to use localhost? See #39011.
Edit: This is not a blocker. The test is under test/internet so it should be ok as is.
mcollina left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer this test to not use the Internet. Is there a specific reason it should?
Fixes: #39919 Refs: #39934 PR-URL: #42838 Reviewed-By: Paolo Insogna <[email protected]> Reviewed-By: Rafael Gonzaga <[email protected]> Reviewed-By: Mohammed Keyvanzadeh <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Fixes: #39919 Refs: #39934 PR-URL: #42838 Reviewed-By: Paolo Insogna <[email protected]> Reviewed-By: Rafael Gonzaga <[email protected]> Reviewed-By: Mohammed Keyvanzadeh <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Fixes: #39919 Refs: #39934 PR-URL: #42838 Reviewed-By: Paolo Insogna <[email protected]> Reviewed-By: Rafael Gonzaga <[email protected]> Reviewed-By: Mohammed Keyvanzadeh <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Fixes: #39919 Refs: #39934 PR-URL: #42838 Reviewed-By: Paolo Insogna <[email protected]> Reviewed-By: Rafael Gonzaga <[email protected]> Reviewed-By: Mohammed Keyvanzadeh <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Fixes: #39919 Refs: #39934 PR-URL: #42838 Reviewed-By: Paolo Insogna <[email protected]> Reviewed-By: Rafael Gonzaga <[email protected]> Reviewed-By: Mohammed Keyvanzadeh <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Fixes: nodejs/node#39919 Refs: nodejs/node#39934 PR-URL: nodejs/node#42838 Reviewed-By: Paolo Insogna <[email protected]> Reviewed-By: Rafael Gonzaga <[email protected]> Reviewed-By: Mohammed Keyvanzadeh <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
The bug posted by @szmarczak is because of not checking the truthy value of
options.servernamein line 3101 and 3102 oflib/internal/http2/core.js, instead theoptions.servernameis strictly checked againstundefined, any value other thanundefinedwill give undesirable result in this case.So in this PR,
is changed to,
Here, the truthy value of
options.servernameis checked rather than strict check againstundefined.I have built node.js locally and checked against the code posted by @szmarczak to reproduce the bug.