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 · 6 comments
Open

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

codenoid opened this issue Jan 31, 2020 · 6 comments

Comments

@codenoid
Copy link

@codenoid 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

@ianlancetaylor ianlancetaylor commented Jan 31, 2020

@nigeltao
Copy link
Contributor

@nigeltao 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 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 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 the help wanted label Feb 5, 2020
@odeke-em odeke-em added this to the Backlog milestone Feb 5, 2020
@mengzhuo
Copy link
Contributor

@mengzhuo mengzhuo commented Oct 23, 2020

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

@nigeltao nigeltao commented Oct 24, 2020

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:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants
You can’t perform that action at this time.