-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
Don't use broken ALPN on Android 4.4 #1305
Comments
I guess what would be great is adding back NPN but as a fallback when ALPN support is missing. |
Actually, if ALPN is buggy in Android 4.4 the fallback is not a good idea. 4d06821#diff-052708b701881930617b926799cba4b8L53 |
@ejona86 yup, good point. As far as I know, NPN works fine on the platforms we supported it on. |
For background, my original pull request: #1201 My pull request had open questions so I think it should be reverted. Summary:
Other points to be aware of: NPN support in Android is also not perfect. There is an internal Android bug report 18705877 I created in Dec 2014. The bug causes problems if a mix of NPN and non-NPN sockets are being created from the same SSLContext / SocketFactory. My imperfect understanding is that the "should I use NPN?" information is being set on the SSL context, not on the socket. Later sockets from that context that do not use NPN end up failing with: Caused by: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0xb8421b40: Failure in SSL library, usually a protocol error
To quote somebody who knows a lot more about OpenSSL than me: "If the SSL_CTX has an next_proto_select_cb, it will advertise the extension in ClientHello and then if you select nothing (e.g., you don't want NPN for this particular SSL connection), it results in a TLS1_AD_INTERNAL_ERROR." There may be a workaround for this we can apply in OkHttp for this NPN issue if we return to supporting it. I'd need to look more closely. Looking to the future: It looks like the most likely scenario is that NPN will be removed from Android in a future release in favor of ALPN. I will chase up the ALPN issue and see if there is a fix coming in a future Android release, but if the ALPN implementation is broken in KitKat it's possible that NPN would be a better choice there. |
Next steps: |
@swankjesse what do you recommend that we use in the interim? I changed my version from 2.2.0 to 2.1.0 and see the following issue: I/DEBUG ( 1510): #10 pc 000c53d3 /system/lib/libcrypto.so (CRYPTO_malloc+66) |
I've been chasing up the various bugs on Android and their historic state. Here's my understanding:
|
With this PR, I've dropped support for ALPN on Android 4.4: Here's the combination of things to run OkHttp tests on an Android emulator:
Note that this is incomplete; vogar doesn't implement |
It sounds like there was some agreement here on restoring NPN for Android 4.4 and below. Has anything come of this? If I submit a PR is there a chance it could be merged or is NPN a dead issue? |
No more NPN. If you need it, fork! |
As described in Platform.java, ALPN is only supported on Android 4.4 or higher which is currently 40% of the market share. For apps currently using SPDY, this means giving up notable performance for most users.
I couldn't find any reasoning in #1243 for why the NPN removal was useful. What would prohibit restoring NPN support?
The text was updated successfully, but these errors were encountered: