-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
http: don't throw on Uint8Array
s for http.ServerResponse#write
#33155
Conversation
4cf2098
to
7ce222f
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.
I would prefer if you tried to make it as similar as possible to what's in Writable
.
Also, please try to avoid unrelated whitespace changes.
Http2Server.Response.write
Http2Server.Response.write
Yeah, I think this should also change the HTTP/1 code and leave HTTP/2 alone because that’s already doing the right thing, like #33146 👍 |
@addaleax Sorry but I'm confused as to what you are referring to the 'right thing'. If I'm understanding this right, do you want me to remove these type checks for write (in http2), and what should I change in http/1 (since it already has type checks)? |
@rexagod Fit the HTTP/1 code so that it also accepts any type of Uint8Array (i.e. replace |
56a56f0
to
b253d17
Compare
Thank you so much for clearing this up for me, @addaleax! Sometimes I miss to see the obvious and it's really frustrating! 😅 |
@ronag PTAL. I think your comment got resolved. |
83686ad
to
fde814e
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.
This is changing http1 which already has type checks. Not sure if the Uint8Array
check works so that might be worth fixing.
@ronag Should I remove all changes from outgoing and just commit the test? |
Could you also add a test for the uint8array case? Also please fix the commit msg and PR description. |
3872384
to
33484b2
Compare
dont throw errors on Uint8Arrays and added test for all valid types Co-authored-by: Ruben Bridgewater <ruben@bridgewater.de> fixup: remove dup fixup: remove unused dec fixup: add Uint8Array check in test fixup: don't throw invalid arg error on `Uint8Array`s
Http2Server.Response.write
Uint8Array
s for http.ServerResponse#write
Landed in 2b50cd7 |
@codebytere Yes, it just needs to be applied in a different part of the function that #31818 had moved around (but not really introduced). @rexagod Would you be willing to backport this yourself? The guide for how to do that is in https://github.com/nodejs/node/blob/master/doc/guides/backporting-to-release-lines.md. If you’d prefer, you can also let us know that somebody else should pick that up. |
Don't throw errors on Uint8Arrays and added test for all valid types. Backport-PR-URL: nodejs#33488 PR-URL: nodejs#33155 Fixes: nodejs#33379 Refs: nodejs#29829 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Zeyu Yang <himself65@outlook.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Don't throw errors on Uint8Arrays and added test for all valid types. Backport-PR-URL: nodejs#33490 PR-URL: nodejs#33155 Fixes: nodejs#33379 Refs: nodejs#29829 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Zeyu Yang <himself65@outlook.com> Reviewed-By: James M Snell <jasnell@gmail.com>
ping @addaleax |
Don't throw errors on Uint8Arrays and added test for all valid types. Backport-PR-URL: #33490 PR-URL: #33155 Fixes: #33379 Refs: #29829 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Zeyu Yang <himself65@outlook.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Don't throw errors on Uint8Arrays and added test for all valid types. Backport-PR-URL: #33490 PR-URL: #33155 Fixes: #33379 Refs: #29829 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Zeyu Yang <himself65@outlook.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Don't throw errors on Uint8Arrays and added test for all valid types. Backport-PR-URL: #33488 PR-URL: #33155 Fixes: #33379 Refs: #29829 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Zeyu Yang <himself65@outlook.com> Reviewed-By: James M Snell <jasnell@gmail.com>
The title says http.ServerResponse#write |
Same as #33146 but for
write
Refs: #29829
Fixes: #33379
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes