Jasonette / Jasonette/JASONETTE-Android

cookies are not stored

Open
#259 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.6k
Forks
266
PR merge metrics
No merged PRs in 30d

Description

In JasonNetworkAction.java, this is the code that obtains an HTTPClient

```
OkHttpClient client;
if(options.has("timeout")) {
Object timeout = options.get("timeout");
if(timeout instanceof Long) {
client = ((Launcher)context.getApplicationContext()).getHttpClient((long)timeout);
} else if (timeout instanceof String){
Long timeout_int = Long.parseLong((String)timeout);
client = ((Launcher)context.getApplicationContext()).getHttpClient(timeout_int);
} else {
client = ((Launcher)context.getApplicationContext()).getHttpClient(0);
}
} else{
client = ((Launcher)context.getApplicationContext()).getHttpClient(0);
}
```
This is the getHttpClient method in Launcher.java

```public OkHttpClient getHttpClient(long timeout) {
if(timeout > 0) {
return new OkHttpClient.Builder()
.writeTimeout(timeout, TimeUnit.SECONDS)
.readTimeout(timeout, TimeUnit.SECONDS)
.build();
} else {
return new OkHttpClient.Builder().build();
}
}
```

And this is the code that builds a default OkHttpClient()

```public Builder() {
dispatcher = new Dispatcher();
protocols = DEFAULT_PROTOCOLS;
connectionSpecs = DEFAULT_CONNECTION_SPECS;
eventListenerFactory = EventListener.factory(EventListener.NONE);
proxySelector = ProxySelector.getDefault();
cookieJar = CookieJar.NO_COOKIES;
socketFactory = SocketFactory.getDefault();
hostnameVerifier = OkHostnameVerifier.INSTANCE;
certificatePinner = CertificatePinner.DEFAULT;
proxyAuthenticator = Authenticator.NONE;
authenticator = Authenticator.NONE;
connectionPool = new ConnectionPool();
dns = Dns.SYSTEM;
followSslRedirects = true;
followRedirects = true;
retryOnConnectionFailure = true;
connectTimeout = 10_000;
readTimeout = 10_000;
writeTimeout = 10_000;
pingInterval = 0;
}
```

So it would seem that cookies will not be persistent, and session will not be handled properly if cookie based session is used.

Contributor guide

Open the contributing guide

Research direction

Start with the HTTP client creation in JasonNetworkAction.java and the getHttpClient method in Launcher.java, then compare it with the OkHttpClient.Builder default showing CookieJar.NO_COOKIES. Trace how requests use the client and verify that cookie-based sessions persist as expected, adding or running the relevant tests if present.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.