rsnext/packages/next/server
George Karagkiaouris 450552ddba
Split Set-Cookie header correctly (#30560)
## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

Fixes #30430 

There's some more discussion in the issue, but in summary:
- web `Headers` implementation combines all header values with `', '`
- For `Set-Cookie` headers, you're supposed to set them as separate values, not combine them
- web `Headers` forbids the use of `Cookie`, `Set-Cookie` and some more headers, so they don't have custom implementation for those, and still joins them with `,`
- We currently just split them using `split(',')`, but this breaks when the header contains a date (expires, max-age) that also includes a `,`

I used this method to split the Set-Cookie header properly: https://www.npmjs.com/package/set-cookie-parser#splitcookiestringcombinedsetcookieheader as suggested [here](https://github.com/whatwg/fetch/issues/973#issuecomment-559678813)

I didn't add it as a dependency, since we only needed that one method and I wasn't sure what the process is for adding dependencies, so I just added the method in the middleware utils
2021-10-28 17:46:58 +00:00
..
dev Add new target for middleware (#30299) 2021-10-26 18:50:56 +02:00
lib Migrate server-sent events HMR connection to WebSocket (#29903) 2021-10-15 07:09:54 +00:00
web Split Set-Cookie header correctly (#30560) 2021-10-28 17:46:58 +00:00
accept-header.ts Implement Middleware RFC (#30081) 2021-10-20 17:52:11 +00:00
api-utils.ts Add new target for middleware (#30299) 2021-10-26 18:50:56 +02:00
config-shared.ts Move outputFileTracing config up (#30295) 2021-10-25 23:22:45 -05:00
config-utils.ts Remove webpack 4 support (#29660) 2021-10-06 17:40:01 +02:00
config.ts Move outputFileTracing config up (#30295) 2021-10-25 23:22:45 -05:00
crypto-utils.ts Move next-server directory files to server directory (#26756) 2021-06-30 13:44:40 +02:00
denormalize-page-path.ts Move next-server directory files to server directory (#26756) 2021-06-30 13:44:40 +02:00
font-utils.ts Move next-server directory files to server directory (#26756) 2021-06-30 13:44:40 +02:00
get-page-files.ts Move next-server directory files to server directory (#26756) 2021-06-30 13:44:40 +02:00
get-route-from-entrypoint.ts Move next-server directory files to server directory (#26756) 2021-06-30 13:44:40 +02:00
htmlescape.ts Upgrade to Prettier 2 (#13061) 2020-05-18 15:24:37 -04:00
image-config.ts Change AVIF to opt-in via configuration (#30180) 2021-10-22 21:08:03 +00:00
image-optimizer.ts Change AVIF to opt-in via configuration (#30180) 2021-10-22 21:08:03 +00:00
incremental-cache.ts Fix revalidate for initial notFound: true paths (#28097) 2021-08-14 13:11:40 +00:00
load-components.ts Add new target for middleware (#30299) 2021-10-26 18:50:56 +02:00
next-server.ts Split Set-Cookie header correctly (#30560) 2021-10-28 17:46:58 +00:00
next.ts Use import() to load next.config.js (#29935) 2021-10-16 14:22:42 +02:00
node-polyfill-fetch.js Add next.config.js option to override default keepAlive (#27709) 2021-08-03 00:38:42 +00:00
normalize-page-path.ts Move next-server directory files to server directory (#26756) 2021-06-30 13:44:40 +02:00
optimize-amp.ts Move next-server directory files to server directory (#26756) 2021-06-30 13:44:40 +02:00
render-result.ts Add new target for middleware (#30299) 2021-10-26 18:50:56 +02:00
render.tsx Simplify rsc related configs and fix test (#30546) 2021-10-28 19:02:55 +02:00
require.ts Add new target for middleware (#30299) 2021-10-26 18:50:56 +02:00
response-cache.ts upgrade to typescript 4.4.3 (#29112) 2021-09-16 18:06:57 +02:00
router.ts Implement Middleware RFC (#30081) 2021-10-20 17:52:11 +00:00
send-payload.ts Simplify RenderResult (#28900) 2021-09-08 16:56:31 +00:00
serve-static.ts Add support for AVIF to next/image (#29683) 2021-10-11 23:17:47 +00:00
utils.ts Add crawler blocking for fallback: true (#29121) 2021-09-16 11:01:28 -05:00