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

cookies are not stored #259

Open
zhenkuncua opened this issue Feb 26, 2019 · 0 comments
Open

cookies are not stored #259

zhenkuncua opened this issue Feb 26, 2019 · 0 comments

Comments

@zhenkuncua
Copy link

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

        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()

      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.

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

No branches or pull requests

1 participant