Let HttpsURLConnection.setSSLSocketFactory(null) throw IAE.
HttpsURLConnection.setSSLSocketFactory(null) is documented
to throw IAE. Since at least Android KitKat, it instead
reset the connection to use the default SSLSocketFactory.
This was because HttpsURLConnectionImpl delegated to
OkHttpClient, which interpreted a null value to mean to use
the default.
This CL fixes the behavior to be consistent with documentation.
The corresponding bug has been fixed in upstream OkHttp
through commit f704f9d30e941ebdbdc95843c931cfc9d34bcba6 .
This CL topic backports that change and the corresponding
fix into Android's implementation, which is still based on
OkHttp 2.7.5.
Bug: 73702052
Test: libcore's URLConnectionTest.testNullSSLSocketFactory_throws()
fails before but passes after this CL.
Change-Id: I593a4a9b826608e30c345a490c136722aead8cbd
Loading
Please sign in to comment