Giter Club home page Giter Club logo

Comments (3)

lpsinger avatar lpsinger commented on August 15, 2024

This unit test ought to have caught this, but it did not because the various fetch implementations treat the Cookie field differently. Consider the following code snippet:

const h = new Headers()
h.append('cookie', 'foo')
h.append('cookie', 'bar')
console.log(h.get('cookie'))

The following implementations print 'foo, bar', with a comma: @remix-run/[email protected], Safari 17.5, Firefox 127.0.2, Chrome 126.0.6478.127

The following implementations print 'foo; bar', with a semicolon: Node.js 20.14.0, [email protected]

The tests are probably run with either native fetch or undici, although the default Remix configuration (without the feature flag nativeFetch set) probably uses @remix-run/web-fetch. So the test passes but the bug it's checking for appears in production.

I think that it is pretty clear that the browser along with @remix-run/web-fetch are doing what the the fetch standard says: they are joining multiple occurrences of headers with a comma and a space; the standard does not specify any special treatment for the cookie header. It is Node and undici that are violating the spec here --- although IMHO their behavior is a better design than the standard!

So I concur with @Courey: the fix here is to bring back the more portable method of reading the request cookie header from https://github.com/remix-run/remix/pull/1709/files#diff-e37d9e295b178aa51a4880acae4b8bc7f82759e6868583513a5fa52b16846408L102-R102. That won't make a difference for the (evidently not standards-conforming) Node.js native fetch or undici, but it will fix the matter for the legacy Remix fetch polyfill, and presumably any other JavaScript runtimes that do conform to the spec.

from remix.

github-actions avatar github-actions commented on August 15, 2024

🤖 Hello there,

We just published version 2.10.3-pre.0 which involves this issue. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

from remix.

github-actions avatar github-actions commented on August 15, 2024

🤖 Hello there,

We just published version 2.10.3 which involves this issue. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

from remix.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.