Skip to content

http2: Fix "ERR_HTTP2_INVALID_CONNECTION_HEADERS" error when adding "connection' into header - #23908

Closed
sagitsofan wants to merge 22 commits into
nodejs:masterfrom
sagitsofan:http_compat
Closed

http2: Fix "ERR_HTTP2_INVALID_CONNECTION_HEADERS" error when adding "connection' into header#23908
sagitsofan wants to merge 22 commits into
nodejs:masterfrom
sagitsofan:http_compat

Conversation

@sagitsofan

@sagitsofansagitsofan commented Oct 26, 2018

Copy link
Copy Markdown
Contributor

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-botnodejs-github-bot added dont-land-on-v6.x http2 Issues or PRs related to the http2 subsystem. labels Oct 26, 2018

@jasnelljasnell left a comment

Copy link
Copy Markdown
Member

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

Comment threadlib/internal/http2/util.js Outdated
@sagitsofan

sagitsofan commented Oct 27, 2018

Copy link
Copy Markdown
ContributorAuthor

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

@apapirovskiapapirovski left a comment

Copy link
Copy Markdown
Contributor

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.

Comment threadlib/internal/http2/compat.js Outdated
Comment threadlib/internal/http2/compat.js Outdated
Comment threadlib/internal/http2/compat.js Outdated
Comment threadlib/internal/http2/compat.js Outdated
Comment threadlib/internal/http2/compat.js Outdated
@sagitsofan

Copy link
Copy Markdown
ContributorAuthor

@sagitsofan

Copy link
Copy Markdown
ContributorAuthor

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

@dougwilson

Copy link
Copy Markdown
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

@mcollinamcollina left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
Member

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

@mcollina

Copy link
Copy Markdown
Member

@sagitsofansagitsofan changed the title Http compatLib: Http2, Fix "ERR_HTTP2_INVALID_CONNECTION_HEADERS" when adding connection headerDec 3, 2018
@sagitsofansagitsofan changed the title Lib: Http2, Fix "ERR_HTTP2_INVALID_CONNECTION_HEADERS" when adding connection headerhttp2: Fix "ERR_HTTP2_INVALID_CONNECTION_HEADERS" when adding connection headerDec 3, 2018
@sagitsofansagitsofan changed the title http2: Fix "ERR_HTTP2_INVALID_CONNECTION_HEADERS" when adding connection headerhttp2: Fix "ERR_HTTP2_INVALID_CONNECTION_HEADERS" error when adding connection into headerDec 3, 2018
@sagitsofansagitsofan changed the title http2: Fix "ERR_HTTP2_INVALID_CONNECTION_HEADERS" error when adding connection into headerhttp2: Fix "ERR_HTTP2_INVALID_CONNECTION_HEADERS" error when adding "connection' into headerDec 3, 2018
@sagitsofan

sagitsofan commented Dec 4, 2018

Copy link
Copy Markdown
ContributorAuthor

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

@sagitsofan

Copy link
Copy Markdown
ContributorAuthor

@jasnell@apapirovski Can you please review?

@sagitsofan

Copy link
Copy Markdown
ContributorAuthor

@jasnell ?

@mcollina

Copy link
Copy Markdown
Member

Can you please add a unit test?

@mcollina
mcollina dismissed their stale reviewDecember 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
Copy Markdown
ContributorAuthor

@jasnell@mcollina Added test, please review.

@mcollinamcollina left a comment

Copy link
Copy Markdown
Member

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

sagitsofan commented Dec 15, 2018

Copy link
Copy Markdown
ContributorAuthor

@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.

@mcollinamcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@sagitsofan

Copy link
Copy Markdown
ContributorAuthor

@jasnell Pinging again :-)

@sagitsofan

Copy link
Copy Markdown
ContributorAuthor

Thanx.
Who is landing this PR?

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

Copy link
Copy Markdown
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:

returnname!==constants.HTTP2_HEADER_CONNECTION||value==='trailers';

@BridgeAR

Copy link
Copy Markdown
Member

@BridgeARBridgeAR 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
Copy Markdown
Member

Landed in 8c597df 🎉

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

@BridgeARBridgeAR 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#23908Fixes: 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: #23908Fixes: #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>
@BridgeARBridgeAR 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: #23908Fixes: #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: #23908Fixes: #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>
@BethGriggsBethGriggs mentioned this pull request May 1, 2019
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.http2Issues 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

@sagitsofan@dougwilson@mcollina@BridgeAR@apapirovski@jasnell@nodejs-github-bot