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: Fix "ERR_HTTP2_INVALID_CONNECTION_HEADERS" error when adding "connection' into header #23908

Closed
wants to merge 22 commits into from

Conversation

sagitsofan
Copy link
Contributor

@sagitsofan sagitsofan commented Oct 26, 2018

lib: http2 compatibility connection header

When adding the connection header into
http2 response, an ERR_HTTP2_INVALID_CONNECTION_HEADERS
error is thrown.

This PR is ignoring the connection header and disable the
ERR_HTTP2_INVALID_CONNECTION_HEADERS error.
A new warning log is emitted on the compatibility.

Fixes: #23748

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added dont-land-on-v6.x http2 Issues or PRs related to the http2 subsystem. labels Oct 26, 2018
Copy link
Member

@jasnell jasnell left a comment

Choose a reason for hiding this comment

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

This would change the behavior for non-compat mode also, which is not ideal. The check should be done in compat.js rather than in util.js

lib/internal/http2/util.js Outdated Show resolved Hide resolved
@sagitsofan
Copy link
Contributor Author

sagitsofan commented Oct 27, 2018

Ok.
I will move it into the compatibility API, and update this PR.

Copy link
Member

@apapirovski apapirovski left a comment

Choose a reason for hiding this comment

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

This is unfortunately not the right approach. I've left some comments.

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
@sagitsofan
Copy link
Contributor Author

@sagitsofan
Copy link
Contributor Author

What about this PR, it is waiting for approval long time.

@dougwilson
Copy link
Member

Hi @sagitsofan , I was just a passer by, similar to you and just had a comment; I don't have the ability to move this further along and eventually merge, sorry.

mcollina
mcollina previously approved these changes Dec 3, 2018
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

@jasnell @apapirovski can you check again?

@mcollina
Copy link
Member

mcollina commented Dec 3, 2018

@sagitsofan can you please update the title/description on the PR to something more related the actual change?

@mcollina
Copy link
Member

mcollina commented Dec 3, 2018

@sagitsofan sagitsofan changed the title Http compat Lib: Http2, Fix "ERR_HTTP2_INVALID_CONNECTION_HEADERS" when adding connection header Dec 3, 2018
@sagitsofan sagitsofan changed the title Lib: Http2, Fix "ERR_HTTP2_INVALID_CONNECTION_HEADERS" when adding connection header http2: Fix "ERR_HTTP2_INVALID_CONNECTION_HEADERS" when adding connection header Dec 3, 2018
@sagitsofan sagitsofan changed the title http2: Fix "ERR_HTTP2_INVALID_CONNECTION_HEADERS" when adding connection header http2: Fix "ERR_HTTP2_INVALID_CONNECTION_HEADERS" error when adding connection into header Dec 3, 2018
@sagitsofan sagitsofan changed the title http2: Fix "ERR_HTTP2_INVALID_CONNECTION_HEADERS" error when adding connection into header http2: Fix "ERR_HTTP2_INVALID_CONNECTION_HEADERS" error when adding "connection' into header Dec 3, 2018
@sagitsofan
Copy link
Contributor Author

sagitsofan commented Dec 4, 2018

@mcollina i updated the title and description and fix the conflicts

@sagitsofan
Copy link
Contributor Author

@jasnell @apapirovski Can you please review?

@sagitsofan
Copy link
Contributor Author

@jasnell ?

@mcollina
Copy link
Member

Can you please add a unit test?

@mcollina mcollina dismissed their stale review December 11, 2018 13:37

a unit test is needed

Ignoring the connection header and disable the
`ERR_HTTP2_INVALID_CONNECTION_HEADERS` error.

Added a warning log on the compatibility.

Fixes: nodejs#23748
@sagitsofan
Copy link
Contributor Author

@jasnell @mcollina Added test, please review.

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.

The test should verify if the warning is emitted.

@sagitsofan
Copy link
Contributor Author

sagitsofan commented Dec 15, 2018

@mcollina, I have verified that the warning is emitted and also i am making sure that adding the connection into the header is not throwing any exception.

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

@sagitsofan
Copy link
Contributor Author

@jasnell Pinging again :-)

@sagitsofan
Copy link
Contributor Author

Thanx.
Who is landing this PR?

if (name !== constants.HTTP2_HEADER_CONNECTION)
return true;
else
return value === 'trailers';
Copy link
Member

Choose a reason for hiding this comment

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

Nit: this could be simplified to:

return name !== constants.HTTP2_HEADER_CONNECTION ||
       value === 'trailers';

@BridgeAR
Copy link
Member

@BridgeAR BridgeAR added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jan 3, 2019
@BridgeAR
Copy link
Member

BridgeAR commented Mar 4, 2019

Landed in 8c597df 🎉

I took the liberty to improve the commit message and addressed my nit while landing.

@BridgeAR BridgeAR closed this Mar 4, 2019
BridgeAR pushed a commit to BridgeAR/node that referenced this pull request Mar 4, 2019
When using the compatibility API the connection header is from now on
ignored instead of throwing an `ERR_HTTP2_INVALID_CONNECTION_HEADERS`
error.
This logs a warning in such case to notify the user about the ignored
header.

PR-URL: nodejs#23908
Fixes: nodejs#23748
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
BridgeAR pushed a commit that referenced this pull request Mar 4, 2019
When using the compatibility API the connection header is from now on
ignored instead of throwing an `ERR_HTTP2_INVALID_CONNECTION_HEADERS`
error.
This logs a warning in such case to notify the user about the ignored
header.

PR-URL: #23908
Fixes: #23748
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
@BridgeAR BridgeAR mentioned this pull request Mar 4, 2019
BridgeAR pushed a commit that referenced this pull request Mar 5, 2019
When using the compatibility API the connection header is from now on
ignored instead of throwing an `ERR_HTTP2_INVALID_CONNECTION_HEADERS`
error.
This logs a warning in such case to notify the user about the ignored
header.

PR-URL: #23908
Fixes: #23748
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
BethGriggs pushed a commit that referenced this pull request Apr 16, 2019
When using the compatibility API the connection header is from now on
ignored instead of throwing an `ERR_HTTP2_INVALID_CONNECTION_HEADERS`
error.
This logs a warning in such case to notify the user about the ignored
header.

PR-URL: #23908
Fixes: #23748
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
@BethGriggs BethGriggs mentioned this pull request May 1, 2019
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.

http2/http1 compatibility API error with connection header
7 participants