Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions app/src/main/java/at/bitfire/icsdroid/AppHttpClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ import io.ktor.client.engine.HttpClientEngine
import io.ktor.client.engine.okhttp.OkHttp
import io.ktor.client.plugins.HttpTimeout
import io.ktor.client.plugins.UserAgent
import io.ktor.client.plugins.api.Send
import io.ktor.client.plugins.api.createClientPlugin
import io.ktor.client.plugins.cookies.HttpCookies
import io.ktor.http.HttpHeaders
import okhttp3.brotli.BrotliInterceptor
import okhttp3.internal.tls.OkHostnameVerifier
import javax.net.ssl.SSLContext
Expand Down Expand Up @@ -85,6 +88,16 @@ class AppHttpClient @AssistedInject constructor(
// Enable cookie storage - in memory, will be lost on app restart
install(HttpCookies)

// Some servers have issues with the Accept-Charset header. It is actually deprecated/not-recommended by RFC 9110 §12.5.2.
// Ktor adds it by default, so we need to manually strip it with a custom plugin.
install(createClientPlugin("RemoveAcceptCharsetHeader") {
on(Send) { request ->
// Remove the header added by Ktor by default because some servers have problems with it
request.headers.remove(HttpHeaders.AcceptCharset)
proceed(request)
}
})

// Disable redirect following, it's handled by CalendarFetcher
followRedirects = false
}
Expand Down