-
-
Notifications
You must be signed in to change notification settings - Fork 666
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Bug Description
The Cookie header field [COOKIE] uses a semicolon (";") to delimit cookie-pairs (or "crumbs").
Currently the implementation has no special case for the cookie
header and uses commas (",") as delimiter.
Using semicolon as delimiter should be an easy fix, otoh the linked RFC section continues:
To allow for better compression efficiency, the Cookie header field MAY be split into separate header fields, each with one or more cookie-pairs.
So maybe instead of
cookie: a=b; c=d; e=f
undici should send
cookie: a=b
cookie: c=d
cookie: e=f
🤔
Reproducible By
import http2 from "node:http2";
import { H2CClient } from "undici";
const port = process.env.PORT ?? 3001;
http2
.createServer((req, res) => {
console.log(req.headers);
res.end();
})
.listen(port, async () => {
const headers = { cookie: ["a=b", "c=d", "e=f"] };
const client = new H2CClient(`http://localhost:${port}`);
await client.request({ path: "/", method: "GET", headers });
});
[Object: null prototype] {
':authority': 'localhost:3001',
':method': 'GET',
':path': '/',
':scheme': 'https',
cookie: 'a=b, c=d, e=f',
Symbol(sensitiveHeaders): [ 'cookie' ]
}
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working