Closed
Description
- Version: 8.7.0
- Platform: Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64 x86_64
- Subsystem:
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.
headers['set-cookie'] = ['mycookie=foo'];
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
- At line 404,
isArray
is set to true in this case:node/lib/internal/http2/util.js
Line 404 in f16b9c1
- At line 410,
value
is converted to a single string:node/lib/internal/http2/util.js
Line 410 in f16b9c1
- But then at line 433, it's again split into individual characters even though it's been already converted to a single string in step 2 above:
node/lib/internal/http2/util.js
Line 433 in f16b9c1