forked from starfish23/mangafeed
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix extension interceptors receiving compressed responses (#10388)
- Loading branch information
1 parent
cf6f7c5
commit d6c4af8
Showing
2 changed files
with
24 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
core/src/main/java/eu/kanade/tachiyomi/network/interceptor/IgnoreGzipInterceptor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package eu.kanade.tachiyomi.network.interceptor | ||
|
||
import okhttp3.Interceptor | ||
import okhttp3.Response | ||
|
||
/** | ||
* To use [okhttp3.brotli.BrotliInterceptor] as a network interceptor, | ||
* add [IgnoreGzipInterceptor] right before it. | ||
* | ||
* This nullifies the transparent gzip of [okhttp3.internal.http.BridgeInterceptor] | ||
* so gzip and Brotli are explicitly handled by the [okhttp3.brotli.BrotliInterceptor]. | ||
*/ | ||
class IgnoreGzipInterceptor : Interceptor { | ||
override fun intercept(chain: Interceptor.Chain): Response { | ||
var request = chain.request() | ||
if (request.header("Accept-Encoding") == "gzip") { | ||
request = request.newBuilder().removeHeader("Accept-Encoding").build() | ||
} | ||
return chain.proceed(request) | ||
} | ||
} |