From 67d8428b85d322100998da12de54eb500f62a9d1 Mon Sep 17 00:00:00 2001 From: Claude Brisson Date: Sat, 29 Nov 2025 11:23:50 +0100 Subject: [PATCH] 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). --- .../org/jeudego/pairgoth/ratings/RatingsHandler.kt | 9 ++------- 1 file changed, 2 insertions(+), 7 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..0c8d8cd 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,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 ->