-
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
[http2] If 'set-cookie' header is an array of a single string, it's split into individual characters #16452
Comments
heh.. that's certainly not good! Will investigate! :-) |
I think the fix can be just a one-line change: setting |
Sorry I meant 'setting |
Hi @jinwoo, thanks for the report! I can indeed confirm that this bug still exists in master. I'm going to open a PR, unless you would like to fix this in which case just let me know and I would be happy to help answer any questions about the process. I think we would like to get this into the next 8.x & 9.x releases. |
Hi @apapirovski , I can whip up a quick fix if that's simpler. |
@jinwoo either way works for me :) If you would like to contribute to Node, please go ahead. You might want to also edit the test at (I just didn't want to come across as pressuring you into fixing this yourself. 😊) |
All right. Will send a PR soon. Thanks! |
This is for issue 16452. When 'set-cookie' header is set with an array that has only one string value, it's split into its individual characters. Fix by resetting `isArray` to false when the value is converted from an array to a string. Fixes: nodejs#16452
Ah. it affects me as I use the headers from http.fetch result.
|
This is for issue 16452. When 'set-cookie' header is set with an array that has only one string value, it's split into its individual characters. Fix by resetting `isArray` to false when the value is converted from an array to a string. Fixes: nodejs/node#16452 PR-URL: nodejs/node#16458 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
This is for issue 16452. When 'set-cookie' header is set with an array that has only one string value, it's split into its individual characters. Fix by resetting `isArray` to false when the value is converted from an array to a string. Fixes: #16452 PR-URL: #16458 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
This is for issue 16452. When 'set-cookie' header is set with an array that has only one string value, it's split into its individual characters. Fix by resetting `isArray` to false when the value is converted from an array to a string. Fixes: #16452 PR-URL: #16458 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
This is for issue 16452. When 'set-cookie' header is set with an array that has only one string value, it's split into its individual characters. Fix by resetting `isArray` to false when the value is converted from an array to a string. Fixes: #16452 PR-URL: #16458 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
This is for issue 16452. When 'set-cookie' header is set with an array that has only one string value, it's split into its individual characters. Fix by resetting `isArray` to false when the value is converted from an array to a string. Fixes: nodejs/node#16452 PR-URL: nodejs/node#16458 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
The 'set-cookie' header field can be an array of multiple values. But when it is an array of only one string, the string is split into an array of its individual characters.
E.g.
will end up with 12 'set-cookie' fields each of which has 'm', 'y', 'c', 'o',... etc as its value.
I think the bug is in
mapToHeaders()
function in util.js:node/lib/internal/http2/util.js
Line 391 in f16b9c1
isArray
is set to true in this case:node/lib/internal/http2/util.js
Line 404 in f16b9c1
value
is converted to a single string:node/lib/internal/http2/util.js
Line 410 in f16b9c1
node/lib/internal/http2/util.js
Line 433 in f16b9c1
The text was updated successfully, but these errors were encountered: