-
-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5e38b00
commit 9450186
Showing
3 changed files
with
37 additions
and
4 deletions.
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
app/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) | ||
} | ||
} |
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