1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-01 06:22:55 +01:00

Garmin: Ignore agps request if etag matches

Some watches reboot on http 304
This commit is contained in:
José Rebelo 2024-05-19 17:58:40 +01:00 committed by Daniele Gobbetti
parent ca8d595493
commit d741b6ff66
3 changed files with 7 additions and 6 deletions

View File

@ -62,8 +62,9 @@ public class AgpsHandler {
LOG.debug("agps request hash = {}, file hash = {}", ifNoneMatch, etag); LOG.debug("agps request hash = {}, file hash = {}", ifNoneMatch, etag);
if (etag.equals(ifNoneMatch)) { if (etag.equals(ifNoneMatch)) {
response.setStatus(304); // FIXME: the 304 reboots some watches, so just ignore the request if the hash matches
return response; //response.setStatus(304);
return null;
} }
} }

View File

@ -63,7 +63,9 @@ public class HttpHandler {
} }
if (response == null) { if (response == null) {
return null; return GdiHttpService.HttpService.RawResponse.newBuilder()
.setStatus(GdiHttpService.HttpService.Status.UNKNOWN_STATUS)
.build();
} }
LOG.debug("Http response status={}", response.getStatus()); LOG.debug("Http response status={}", response.getStatus());

View File

@ -87,9 +87,7 @@ public class WeatherHandler {
} }
default: default:
LOG.warn("Unknown weather path {}", path); LOG.warn("Unknown weather path {}", path);
final GarminHttpResponse response = new GarminHttpResponse(); return null;
response.setStatus(404);
return response;
} }
final String json = GSON.toJson(weatherData); final String json = GSON.toJson(weatherData);