Disabled Http2 in OkHttp

This commit is contained in:
Nite 2022-07-29 15:25:24 +02:00
parent f6ed5a4ff8
commit d7e938ac36
No known key found for this signature in database
GPG Key ID: 1D1AD59B1C6386C1

View File

@ -10,6 +10,7 @@ import javax.net.ssl.SSLContext
import javax.net.ssl.X509TrustManager
import okhttp3.Credentials
import okhttp3.OkHttpClient
import okhttp3.Protocol
import okhttp3.ResponseBody
import okhttp3.logging.HttpLoggingInterceptor
import org.moire.ultrasonic.api.subsonic.interceptors.PasswordHexInterceptor
@ -64,6 +65,9 @@ class SubsonicAPIClient(
}
val okHttpClient: OkHttpClient = baseOkClient.newBuilder()
// Disable HTTP2 because OkHttp with Exoplayer causes a bug. See https://github.com/square/okhttp/issues/6749
// TODO Check if the bug is fixed and try to re-enable HTTP2
.protocols(listOf(Protocol.HTTP_1_1))
.readTimeout(READ_TIMEOUT, MILLISECONDS)
.apply { if (config.allowSelfSignedCertificate) allowSelfSignedCertificates() }
.addInterceptor { chain ->