pull/1391/head
gedoor 3 years ago
parent 59ffcf0b28
commit cc4dc1c99c
  1. 4
      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) @Throws(IOException::class)
override fun intercept(chain: Interceptor.Chain): Response { override fun intercept(chain: Interceptor.Chain): Response {
val original: Request = chain.request() val original: Request = chain.request()
val builder: Request.Builder = original.newBuilder()
//Cronet未初始化 //Cronet未初始化
return if (!CronetLoader.install()) { return if (!CronetLoader.install() || cronetEngine == null) {
chain.proceed(original) chain.proceed(original)
} else try { } else try {
val builder: Request.Builder = original.newBuilder()
//移除Keep-Alive,手动设置会导致400 BadRequest //移除Keep-Alive,手动设置会导致400 BadRequest
builder.removeHeader("Keep-Alive") builder.removeHeader("Keep-Alive")
builder.removeHeader("Accept-Encoding") builder.removeHeader("Accept-Encoding")

Loading…
Cancel
Save