From 935f53cf65e5bad326a1950dd73f1bf43d0d298d Mon Sep 17 00:00:00 2001 From: Claude Brisson Date: Sat, 29 Nov 2025 11:08:48 +0100 Subject: [PATCH] Fix ratings fetch: remove brotli Accept-Encoding header OkHttp doesn't support brotli decompression, so when servers return brotli-compressed content, it was being read as raw binary garbage. Removed explicit Accept-Encoding to let OkHttp handle compression (it automatically adds gzip/deflate which it can decompress). Also removed unnecessary Sec-Fetch-* headers. --- .../kotlin/org/jeudego/pairgoth/ratings/RatingsHandler.kt | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/view-webapp/src/main/kotlin/org/jeudego/pairgoth/ratings/RatingsHandler.kt b/view-webapp/src/main/kotlin/org/jeudego/pairgoth/ratings/RatingsHandler.kt index 803574d..b45dc7f 100644 --- a/view-webapp/src/main/kotlin/org/jeudego/pairgoth/ratings/RatingsHandler.kt +++ b/view-webapp/src/main/kotlin/org/jeudego/pairgoth/ratings/RatingsHandler.kt @@ -107,15 +107,11 @@ 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") + // Let OkHttp handle compression (it supports gzip/deflate but not brotli) .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 ->