Skip to content

Quote cookie values #73

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

Merged
merged 1 commit into from
Jan 2, 2021
Merged

Conversation

jodersky
Copy link
Member

According to RFC2019, this is required for values containing spaces, and is always safe for non-space containing values.

Note that most webservers are quite smart and lenient when parsing cookie headers. This change however is still useful for servers that are very strict (such as undertow).

According to [RFC2019](https://tools.ietf.org/html/rfc2109), this is
required for values containing spaces, and should always be safe for
non-space containing values.

Note that most webservers are quite smart and lenient when parsing
cookie headers. This change however is still useful for servers that
are very strict (such as undertow).
jodersky added a commit to com-lihaoyi/cask that referenced this pull request Dec 26, 2020
Undertow's cookie handling changed slightly in this version, which
prompted two changes:

1. the SameSite cookie no longer accepts null as an argument. Rather
   than adding conditionals to guard setting, we simply change the
   default SameSite value to 'Lax', as is required by modern standards
   anyway https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite:

   > Cookies with SameSite=None must now also specify the Secure
   > attribute (they require a secure context/HTTPS).

2. it no longer handles spaces in cookie values (unless they are
   quoted). This behavior is actually correct according to
   [RFC2109]https://tools.ietf.org/html/rfc2109, which requires cookie
   values to be quoted if they contain spaces. This change is actually
   transparent to cask, but reveals a bug in the
   [requests-scala](com-lihaoyi/requests-scala#73) library.
   Tests pass locally once this issue is fixed.
jodersky added a commit to com-lihaoyi/cask that referenced this pull request Dec 26, 2020
Undertow's cookie handling changed slightly in this version, which
prompted two changes:

1. the SameSite cookie no longer accepts null as an argument. Rather
   than adding conditionals to guard setting, we simply change the
   default SameSite value to 'Lax', as is assumed by modern standards
   anyway https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite:

   > Cookies with SameSite=None must now also specify the Secure
   > attribute (they require a secure context/HTTPS).

2. it no longer handles spaces in cookie values (unless they are
   quoted). This behavior is actually correct according to
   [RFC2109](https://tools.ietf.org/html/rfc2109), which requires cookie
   values to be quoted if they contain spaces. This change is actually
   transparent to cask, but reveals a minor bug in the
   [requests-scala](com-lihaoyi/requests-scala#73) library.
   Tests pass locally once this issue is fixed.
jodersky added a commit to com-lihaoyi/cask that referenced this pull request Dec 26, 2020
Undertow's cookie handling changed slightly in this version, which
prompted two changes:

1. the SameSite cookie no longer accepts null as an argument. Rather
   than adding conditionals to guard setting, we simply change the
   default SameSite value to 'Lax', as is assumed by modern standards
   anyway https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite:

   > The cookie-sending behavior if SameSite is not specified is SameSite=Lax.
   > Previously the default was that cookies were sent for all requests.

2. it no longer handles spaces in cookie values (unless they are
   quoted). This behavior is actually correct according to
   [RFC2109](https://tools.ietf.org/html/rfc2109), which requires cookie
   values to be quoted if they contain spaces. This change is actually
   transparent to cask, but reveals a minor bug in the
   [requests-scala](com-lihaoyi/requests-scala#73) library.
   Tests pass locally once this issue is fixed.
jodersky added a commit to com-lihaoyi/cask that referenced this pull request Jan 2, 2021
Undertow's cookie handling changed slightly in this version, which
prompted two changes:

1. the SameSite cookie no longer accepts null as an argument. Rather
   than adding conditionals to guard setting, we simply change the
   default SameSite value to 'Lax', as is assumed by modern standards
   anyway https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite:

   > The cookie-sending behavior if SameSite is not specified is SameSite=Lax.
   > Previously the default was that cookies were sent for all requests.

2. it no longer handles spaces in cookie values (unless they are
   quoted). This behavior is actually correct according to
   [RFC2109](https://tools.ietf.org/html/rfc2109), which requires cookie
   values to be quoted if they contain spaces. This change is actually
   transparent to cask, but reveals a minor bug in the
   [requests-scala](com-lihaoyi/requests-scala#73) library.
   Tests pass locally once this issue is fixed.
jodersky added a commit to com-lihaoyi/cask that referenced this pull request Jan 2, 2021
Undertow's cookie handling changed slightly in this version, which
prompted two changes:

1. the SameSite cookie no longer accepts null as an argument. Rather
   than adding conditionals to guard setting, we simply change the
   default SameSite value to 'Lax', as is assumed by modern standards
   anyway https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite:

   > The cookie-sending behavior if SameSite is not specified is SameSite=Lax.
   > Previously the default was that cookies were sent for all requests.

2. it no longer handles spaces in cookie values (unless they are
   quoted). This behavior is actually correct according to
   [RFC2109](https://tools.ietf.org/html/rfc2109), which requires cookie
   values to be quoted if they contain spaces. This change is actually
   transparent to cask, but reveals a minor bug in the
   [requests-scala](com-lihaoyi/requests-scala#73) library.
   Tests pass locally once this issue is fixed.
@lihaoyi lihaoyi merged commit b3d8f40 into com-lihaoyi:master Jan 2, 2021
@lihaoyi
Copy link
Member

lihaoyi commented Jan 2, 2021

Thanks @jodersky! Let me know if you'd like me to tag a new release and i'll do so

@jodersky
Copy link
Member Author

jodersky commented Jan 2, 2021

It's not super urgent on my side. It can wait and be bundled with another Scala 3 milestone release

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.

2 participants