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

Provide ability to persist and restore cookie jar #176

Open
gmg137 opened this issue Mar 17, 2020 · 2 comments
Open

Provide ability to persist and restore cookie jar #176

gmg137 opened this issue Mar 17, 2020 · 2 comments
Labels
feature A new feature!

Comments

@gmg137
Copy link

gmg137 commented Mar 17, 2020

Hello, can you increase the local storage and loading of cookies?
Curl-like cookies_jar and cookies_file methods

@sagebind
Copy link
Owner

Thanks for the question! This is currently not available, but would be a welcome improvement! Cookies are only held in memory at the moment.

Currently the cookies subsystem does not involve libcurl at all -- the primary reason for this is performance. Access to persistent cookies (on disk) would require synchronous I/O which would block our event loop, or a thread pool which would be a lot of overhead if not opted into.

To implement this, we would probably want to provide access to the contents of the cookie jar and leave it up to the user how to persist it. We could implement Serialize and Deserialize from Serde, and optionally provide our own serializer that can convert to and from bytes. To restore saved cookies, we could provide another API that allows you to set the contents of the cookie jar, which could be deserialized from some source like a file.

@sagebind sagebind added the feature A new feature! label Mar 19, 2020
@sagebind sagebind added this to the 1.0 milestone Jul 29, 2020
@sagebind sagebind mentioned this issue Jul 29, 2020
8 tasks
@sagebind
Copy link
Owner

sagebind commented Oct 21, 2020

Removing this from the 1.0 milestone, which is cluttered as it is. Persisting or allowing serialization of the cookie jar means we need to pick a particular persistence format and make that part of our public API guarantees. Since the cookie API itself isn't even fully available yet, I am not ready to commit to a particular storage format yet.

The tricky part here is that we need to expose several "implementation details" about the cookie jar, including:

  • The resolved domain based on the request URI that set the cookie.
  • The resolved path based on the request URI that set the cookie.
  • Whether or not the cookie should be resolved using "host-only" logic.

@sagebind sagebind removed this from the 1.0 milestone Oct 21, 2020
@sagebind sagebind changed the title Hello, can you increase the local storage and loading of cookies? Provide ability to persist and restore cookie jar Nov 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A new feature!
Projects
None yet
Development

No branches or pull requests

2 participants