From 29d0cb4a154fd9f0f8b2a0c9ee1572f71a5e0f24 Mon Sep 17 00:00:00 2001 From: Carlos Date: Mon, 8 Jan 2018 05:03:37 -0500 Subject: [PATCH] fixed issue where some sources that use cloudflare use the Server: cloudflare as cloudflare-nginx is deprecated (#1152) --- .../java/eu/kanade/tachiyomi/network/CloudflareInterceptor.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/network/CloudflareInterceptor.kt b/app/src/main/java/eu/kanade/tachiyomi/network/CloudflareInterceptor.kt index 8885e6f16..bc55342ab 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/network/CloudflareInterceptor.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/network/CloudflareInterceptor.kt @@ -14,12 +14,14 @@ class CloudflareInterceptor : Interceptor { private val challengePattern = Regex("""name="jschl_vc" value="(\w+)"""") + private val serverCheck = arrayOf("cloudflare-nginx", "cloudflare") + @Synchronized override fun intercept(chain: Interceptor.Chain): Response { val response = chain.proceed(chain.request()) // Check if Cloudflare anti-bot is on - if (response.code() == 503 && "cloudflare-nginx" == response.header("Server")) { + if (response.code() == 503 && serverCheck.contains(response.header("Server"))) { return chain.proceed(resolveChallenge(response)) }