Fix ratings fetch: don't request brotli compression

OkHttp doesn't support brotli decompression. When we explicitly set
Accept-Encoding header, OkHttp disables its transparent decompression.

Solution: remove explicit Accept-Encoding header and let OkHttp handle
compression automatically (it adds gzip and transparently decompresses).

Also simplified the request headers (removed unused Sec-Fetch-* headers).
This commit is contained in:
Claude Brisson
2025-11-29 11:23:50 +01:00
parent 72f5fe540c
commit 67d8428b85

View File

@@ -107,15 +107,10 @@ abstract class RatingsHandler(val origin: RatingsManager.Ratings) {
val request = Request.Builder()
.url(url)
.header("User-Agent", USER_AGENT)
.header("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8")
.header("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")
.header("Accept-Language", "en-US,en;q=0.9")
.header("Accept-Encoding", "gzip, deflate, br")
// Don't set Accept-Encoding - let OkHttp handle compression transparently
.header("Connection", "keep-alive")
.header("Upgrade-Insecure-Requests", "1")
.header("Sec-Fetch-Dest", "document")
.header("Sec-Fetch-Mode", "navigate")
.header("Sec-Fetch-Site", "none")
.header("Sec-Fetch-User", "?1")
.build()
client.newCall(request).execute().use { response ->