Comments (3)
I may be mistaken, but as I was reading the code for the class
public class SharedPrefsCookiePersistor implements CookiePersistor {
[ ... ]
@Override
public void saveAll(Collection<Cookie> cookies) {
SharedPreferences.Editor editor = sharedPreferences.edit();
for (Cookie cookie : cookies) {
if (cookie.persistent()) {
editor.putString(createCookieKey(cookie), new SerializableCookie().encode(cookie));
}
}
editor.apply();
}
[ ... ]
}
The following piece of code seems weird:
if (cookie.persistent()) {
editor.putString(createCookieKey(cookie), new SerializableCookie().encode(cookie));
}
As shown here
public boolean persistent()
Returns true if this cookie expires at the end of the current session.
The method 'Cookie.persistent()' returns true when it expires at the end of the current session... So shouldn't it be stored when this flag returns false?
I may be mistaken, but I think the issue is the misleading method which seems to do the opposite as you would expect.
from persistentcookiejar.
For now I haven't been able to reproduce any problems with the expiry dates. Also I think that there is an error in the OkHttp Javadoc:
Check this line comment.
private final boolean persistent; // True if 'expires' or 'max-age' is present.
Looking at how the variable is assigned when parsing the cookie seems that the behavior of the persistent flag is the opposite to the one indicated in the javadoc.
from persistentcookiejar.
Thank you for your reply! !
I rewrote saveAll method, do not check the persistent.(The problem may be the server.) Operating normally.
Thanks!!
from persistentcookiejar.
Related Issues (20)
- When i get cookies Access the server ,sometime cookies is null ,
- Error:Cannot change dependencies of configuration ':app:_debugAnnotationProcessor' after it has been resolved.
- How to read cookies? HOT 2
- Proguard rules doesn't make sense?
- How to remove cookies for a target url? HOT 1
- Repo is unavailable HOT 4
- SetCookieCache may lead to ConcurrentModificationException HOT 1
- May I ask you something
- Invalid Cast HOT 3
- could not use chinese as login name (不能使用中文的登录名)
- Kill the process from the background, from the new entry NullPointerException error HOT 1
- Cookies are either not persisting, or not being sent out HOT 1
- Failed to resolve: com.github.franmontiel:PersistentCookieJar:v1.0.1 HOT 2
- If only there were .jar
- Google play rejected my app
- Issue with implementation of the Secure flag in cookies
- Share cookie with Webview HOT 2
- work with Glide
- Why are the results obtained cookie.value() = deleteMe ?
- Check if Cookie exists before making a network call
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from persistentcookiejar.