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

net/http/cookiejar: add a disk backed persistent CookieJar #36921

Open
codenoid opened this issue Jan 31, 2020 · 7 comments
Open

net/http/cookiejar: add a disk backed persistent CookieJar #36921

codenoid opened this issue Jan 31, 2020 · 7 comments
Labels
help wanted NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@codenoid
Copy link

codenoid commented Jan 31, 2020

hi mr, sorry for this silly issue, but can we have this feature in Go ?, i think as a battery-included language, we should have this feature mr.

nb : Python has this feature by the way, https://docs.python.org/3/library/http.cookiejar.html#http.cookiejar.FileCookieJar

@codenoid codenoid changed the title net/http/cookiejar: Persisten load/save cookies into disk net/http/cookiejar: Persisten load/save cookies into disk/[]byte Jan 31, 2020
@codenoid codenoid changed the title net/http/cookiejar: Persisten load/save cookies into disk/[]byte net/http/cookiejar: Persistent load/save cookies from/into disk/[]byte Jan 31, 2020
@ianlancetaylor
Copy link
Contributor

CC @nigeltao

@nigeltao
Copy link
Contributor

nigeltao commented Feb 2, 2020

Quoting https://groups.google.com/d/msg/golang-nuts/7mf8z9bbEcY/bIjQBjePsVUJ from 2015:

Re persistent storage, there was a lot of discussion with [@vdobler] and I a couple of years ago about how to do a cookie jar with pluggable storage, but we never landed on a satisfactory design, let alone a perfect one, so what's in the standard library is not persistent.

@codenoid
Copy link
Author

codenoid commented Feb 2, 2020

but there is possibility right (?)

If you come to us with an existence proof of a good design for a
persistent cookie jar, I'm happy to look at it

@nigeltao
Copy link
Contributor

nigeltao commented Feb 5, 2020

There is a possibility, but it's not going to happen by just waiting for me to get around to it.

@odeke-em odeke-em changed the title net/http/cookiejar: Persistent load/save cookies from/into disk/[]byte net/http/cookiejar: add a disk backed persistent CookieJar Feb 5, 2020
@odeke-em odeke-em added this to the Backlog milestone Feb 5, 2020
@cagedmantis cagedmantis added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Feb 6, 2020
@mengzhuo
Copy link
Contributor

Hi, I'm the author of cookiestxt.
I think it's fair easy to port my code into cookiejar as TextMarshaler interface.

@nigeltao
Copy link
Contributor

If you're talking about adding code to the Go standard library, the hard part isn't decoding/encoding the cookies text format. The hard part is designing an API that allows the persistent storage to be a text format, an SQLite database, other binary formats, etc. There may be thousands of cookies accumulated over months but, ideally, we'd still like better-than-O(N) lookup without first having to load all the cookies into memory. For persistent cookie storage, it should ideally also help handle the case where the Public Suffix List can change in between saving and loading the cookies.

See:

@ZacharyHampton
Copy link

Has anyone made this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

7 participants