From cc4dc1c99c584d7280a26297f8d32aeb4f998d6c Mon Sep 17 00:00:00 2001 From: gedoor Date: Wed, 20 Oct 2021 09:58:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/legado/app/help/http/cronet/CronetInterceptor.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/legado/app/help/http/cronet/CronetInterceptor.kt b/app/src/main/java/io/legado/app/help/http/cronet/CronetInterceptor.kt index 41b631c6e..5f50a387b 100644 --- a/app/src/main/java/io/legado/app/help/http/cronet/CronetInterceptor.kt +++ b/app/src/main/java/io/legado/app/help/http/cronet/CronetInterceptor.kt @@ -9,11 +9,11 @@ class CronetInterceptor(private val cookieJar: CookieJar?) : Interceptor { @Throws(IOException::class) override fun intercept(chain: Interceptor.Chain): Response { val original: Request = chain.request() - val builder: Request.Builder = original.newBuilder() //Cronet未初始化 - return if (!CronetLoader.install()) { + return if (!CronetLoader.install() || cronetEngine == null) { chain.proceed(original) } else try { + val builder: Request.Builder = original.newBuilder() //移除Keep-Alive,手动设置会导致400 BadRequest builder.removeHeader("Keep-Alive") builder.removeHeader("Accept-Encoding")