From f96c0a217c876f439e3e7e63228988160d481898 Mon Sep 17 00:00:00 2001 From: gedoor Date: Tue, 4 May 2021 10:02:23 +0800 Subject: [PATCH] =?UTF-8?q?url=E5=8F=82=E6=95=B0=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E9=87=8D=E8=AF=95=E6=AC=A1=E6=95=B0retry?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt index eb4230e1a..088090555 100644 --- a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt +++ b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt @@ -55,6 +55,7 @@ class AnalyzeUrl( private var charset: String? = null private var method = RequestMethod.GET private var proxy: String? = null + private var retry: Int = 0 init { baseUrl = baseUrl.split(splitUrlRegex, 1)[0] @@ -197,6 +198,7 @@ class AnalyzeUrl( option.js?.let { evalJS(it) } + retry = option.retry } } headerMap[UA_NAME] ?: let { @@ -304,7 +306,7 @@ class AnalyzeUrl( params.tag = tag return getWebViewSrc(params) } - return getProxyClient(proxy).newCallStrResponse { + return getProxyClient(proxy).newCallStrResponse(retry) { removeHeader(UA_NAME) headerMap.forEach { addHeader(it.key, it.value) @@ -326,7 +328,7 @@ class AnalyzeUrl( suspend fun getByteArray(tag: String? = null): ByteArray { setCookie(tag) @Suppress("BlockingMethodInNonBlockingContext") - return getProxyClient(proxy).newCall { + return getProxyClient(proxy).newCall(retry) { removeHeader(UA_NAME) headerMap.forEach { addHeader(it.key, it.value) @@ -375,7 +377,8 @@ class AnalyzeUrl( val headers: Any?, val body: Any?, val type: String?, - val js: String? + val js: String?, + val retry: Int = 0 ) }