Skip to content

Set multiple cookies in multiple set-cookie headers#101

Open
sulami wants to merge 1 commit intosocketry:mainfrom
sulami:set-cookies
Open

Set multiple cookies in multiple set-cookie headers#101
sulami wants to merge 1 commit intosocketry:mainfrom
sulami:set-cookies

Conversation

@sulami
Copy link
Copy Markdown

@sulami sulami commented Apr 23, 2026

This fixes a bug we've hit with Falcon & Rails, where multiple cookies set on a single response would return a single set-cookie header with the values from several cookies joined by ;, which browsers do not accept, and is not compliant with the spec in RFC 6265.

This required decoupling the Cookie and SetCookie implementations, so we can splat Multiple into @fields.

This also introduces spaces after semicolons into the output of cookie#to_s, which is also required by the spec.

Types of Changes

  • Bug fix.

Contribution

  • I added tests for my changes. - No dedicated test for this in particular, but I'm happy to supply one if this approach looks fine otherwise.
  • I tested my changes locally. - I've run a full reproduction with falcon, assigning an array to the set-cookie header, and confirmed behaviour before and after this fix.
  • I agree to the Developer's Certificate of Origin 1.1.

This fixes a bug we've hit with Falcon & Rails, where multiple cookies
set on a single response would return a single `set-cookie` header with
the values from several cookies joined by `;`, which browsers do not
accept, and is not compliant with the spec in RFC 6265.

This required decoupling the `Cookie` and `SetCookie` implementations,
so we can splat `Multiple` into `@fields`.

This also introduces spaces after semicolons into the output of
`cookie#to_s`, which is also required by the spec.
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.

1 participant