Commit 855566ae authored by Daniel Wolf's avatar Daniel Wolf
Browse files

Consider an etag the same as its weak counterpart

parent b459d997
......@@ -193,10 +193,10 @@ class RuleImportService : IntentService("RuleImportService") {
val realChecksum = it.checksum?.replace("<qt>", "\"")
if(realChecksum != null) request.header("If-None-Match", realChecksum)
response = httpClient.newCall(request.build()).execute()
val receivedChecksum = response?.headers.find {
val receivedChecksum = response.headers.find {
it.first.equals("etag", true)
}?.second
val localDataIsRecent = response.code == 304 || (realChecksum != null && receivedChecksum == realChecksum)
val localDataIsRecent = response.code == 304 || (realChecksum != null && (receivedChecksum == realChecksum || receivedChecksum == "W/$realChecksum"))
when {
response.isSuccessful && !localDataIsRecent -> {
response.headers.find {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment