-
Notifications
You must be signed in to change notification settings - Fork 30k
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
test: http2 util passing array in te header #16246
Conversation
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.
LGTM
Just a note for future reference if someone wants to take it on, the pathway this is testing could actually be refactored a bit: node/lib/internal/http2/util.js Lines 363 to 364 in ff747e3
node/lib/internal/http2/util.js Lines 405 to 416 in ff747e3
so it could just be rewritten as: return value !== 'trailers'; |
Thanks @apapirovski, I've updated the commit to add return value.toString() !== 'trailers'; Commit is at trivikr@596df98 |
7b2c4ef
to
596df98
Compare
lib/internal/http2/util.js
Outdated
@@ -360,8 +360,7 @@ function isIllegalConnectionSpecificHeader(name, value) { | |||
case HTTP2_HEADER_TRANSFER_ENCODING: | |||
return true; | |||
case HTTP2_HEADER_TE: | |||
const val = Array.isArray(value) ? value.join(', ') : value; | |||
return val !== 'trailers'; | |||
return value.toString() !== 'trailers'; |
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.
toString()
isn't necessary here (and is bad for perf). If an array slips through then it won't match anyway (because it has at least two items in it). Should just be value !== 'trailers'
.
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.
removed toString()
in the updated commit
This adds a test case in which array with two values is passed to param value in isIllegalConnectionSpecificHeader Refs: nodejs#14985
596df98
to
9a03c2a
Compare
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.
LGTM 👍
This simplifies validation of te header and adds a test case in which array with two values is passed to param value in isIllegalConnectionSpecificHeader PR-URL: nodejs#16246 Refs: nodejs#14985 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Landed in 1fd662c |
This simplifies validation of te header and adds a test case in which array with two values is passed to param value in isIllegalConnectionSpecificHeader PR-URL: #16246 Refs: #14985 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
This simplifies validation of te header and adds a test case in which array with two values is passed to param value in isIllegalConnectionSpecificHeader PR-URL: nodejs/node#16246 Refs: nodejs/node#14985 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
This simplifies validation of te header and adds a test case in which array with two values is passed to param value in isIllegalConnectionSpecificHeader PR-URL: nodejs/node#16246 Refs: nodejs/node#14985 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
This adds a test case in which array with two values is passed to param value in isIllegalConnectionSpecificHeader:
node/lib/internal/http2/util.js
Line 363 in 212de3c
Refs: #14985
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
test, http2