OkHttp fails to set TLS v1.1 and v1.2 on JDK 7
See original GitHub issueDESCRIPTION:
OkHttp creates a SslSocketFactory using SSLContext.getInstance("TLS")
to retrieve default TLS implementation from JDK.
The last public version of JDK 7 (update 80) uses TLS v1 as default.
This behavior has changed in new commercial versions by Oracle JDK 7 update 131 to use TLS v1.2 as default (the same behavior of JDK 8).
PROBLEM:
When running my code on last JDK 7 public version (update 80), I’m not able to connect to servers that uses TLS v1.1 or TLS v1.2.
The connectionsSpecs.tlsVersions feature does nothing because SSLContext.getInstance("TLS")
retrieves v1 implementation.
SOLUTION:
Change SSLContext.getInstance("TLS")
to SSLContext.getInstance("TLSv1.2")
so the JDK 7 will also retrieve TLS v1.2 by default and connectionsSpecs.tlsVersions feature will work as expected as TLS v1.2 can downgrade gracefully to previous versions.
Line to change: https://github.com/square/okhttp/blob/c3d6607a14f66eae3dedc927a3eff642d1493caa/okhttp/src/main/java/okhttp3/internal/platform/Platform.java#L269
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:19
Top GitHub Comments
@yschimke Tests are green now!
You should submit a PR next time, this felt a bit like