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

Preserve multiple Set-Cookie headers #1278

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jordanbtucker
Copy link

This PR ungroups Set-Cookie headers since each header should appear independently. According to MDN:

To send multiple cookies, multiple Set-Cookie headers should be sent in the same response.

For example, the following is correct:

Set-Cookie: a=b
Set-Cookie: c=d

While the following is incorrect:

Set-Cookie: a=b,c=d

This PR achieves this by:

  • Adding an exported formatHeaders function in utils/misc.ts that treats set-cookie as a special case.
  • Removing the private formatHeaders function from HttpResponseTextDocumentView and updating all calls to use the new utility formatHeaders function.
  • Removing the private static formatHeaders function from HttpResponseWebview and updating all calls to use the new utility formatHeaders function.
  • Updating getFullResponseString in HttpResponseWebview to use the new utility formatHeaders function.
  • Updating createRequestInTempFile in HistoryController to use the new utility formatHeaders function.

Fixes #722

@jordanbtucker jordanbtucker changed the title Preserve multiple set-cookie headers Preserve multiple Set-Cookie headers Jun 21, 2024
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

Successfully merging this pull request may close these issues.

Set-Cookie response headers are grouped
1 participant