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

Handle Cookies properly #16

Open
MarcoPolo opened this issue Jul 10, 2024 · 0 comments · May be fixed by #49
Open

Handle Cookies properly #16

MarcoPolo opened this issue Jul 10, 2024 · 0 comments · May be fixed by #49

Comments

@MarcoPolo
Copy link
Collaborator

MarcoPolo commented Jul 10, 2024

...and perhaps other forbidden headers.

This library uses the standard Request/Response types. One limitation of those types is that we don't get access to the Cookie headers. Which means we don't do the same thing the browser does with "Set-Cookie" and sending "Cookie" headers.

Not handling cookies means that some common auth patterns don't work in the HTTP over libp2p stream scenario. Which goes against the goal of being indistinguishable from the browser's native fetch.

We can work around these limitations because at the end of the day we are the ones writing and reading the raw HTTP messages. We can implement our own "cookie store" that maps from a peer to a set of cookies. We can attach the cookies on outgoing requests just as the browser does.

This should be relatively straightforward.

achingbrain added a commit that referenced this issue Dec 11, 2024
Uses the `http-cookie-agent` module to add cookie support to Node.js
(browsers should manage cookies for us).

Fixes #16
@achingbrain achingbrain linked a pull request Dec 11, 2024 that will close this issue
3 tasks
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 a pull request may close this issue.

1 participant