Skip to content
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

support nested headers in http2 #33568

Closed
rexagod opened this issue May 26, 2020 · 0 comments
Closed

support nested headers in http2 #33568

rexagod opened this issue May 26, 2020 · 0 comments

Comments

@rexagod
Copy link
Member

rexagod commented May 26, 2020

Actual Behaviour
For the snippet given below, http1 returns ['A','B'], but http2 returns only ['B'].

res.writeHead(200, [['set-cookie', 'A'],
                    ['set-cookie', 'B'],
                    ['content-type', 'text/plain']]);

Expected Behavior
http2 should return ['A','B'].

Reproduction Code

const server = http2.createServer(function (req, res) {
  res.writeHead(200, [['set-cookie', 'A'],
                        ['set-cookie', 'B'],
                        ['content-type', 'text/plain']]);
  res.end();
});

server.listen(0, () => {
  const url = `http://localhost:${server.address().port}`;
  const clientsession = http2.connect(url);
  const req = clientsession.request();
  req.on('response', (headers) => {
    assert.deepStrictEqual(headers['set-cookie'], ['A', 'B']); // fails
  });
  req.on('end', () => {
    clientsession.close();
    server.close();
  });
});

I think this is caused by an unintentional override inside kSetHeaders method, see below.

this[kHeaders][name] = value;

@rexagod rexagod closed this as completed May 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant