1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-12-23 16:28:51 -05:00

Fix ETag handling

This commit is contained in:
Reinhard Pointner 2016-03-11 19:52:41 +00:00
parent b8f596c064
commit ee11696457
2 changed files with 3 additions and 6 deletions

View File

@ -188,15 +188,16 @@ public class CachedResource<K, R> implements Resource<R> {
try {
debug.fine(WebRequest.log(url, lastModified, etagValue));
if (etagValue != null) {
return WebRequest.fetchIfNoneMatch(url, etagValue);
return WebRequest.fetch(url, 0, etagValue, null, responseHeaders);
} else {
return WebRequest.fetchIfModified(url, lastModified);
return WebRequest.fetch(url, lastModified, null, null, responseHeaders);
}
} catch (FileNotFoundException e) {
return fileNotFound(url, e);
} finally {
List<String> value = responseHeaders.get("ETag");
if (value != null && value.size() > 0 && !value.contains(etagValue)) {
debug.finest(format("Store ETag: %s", value));
etagStorage.put(etagKey, value.get(0));
}
}

View File

@ -110,10 +110,6 @@ public final class WebRequest {
return fetch(resource, ifModifiedSince, null, null, null);
}
public static ByteBuffer fetchIfNoneMatch(URL resource, Object etag) throws IOException {
return fetch(resource, 0, etag, null, null);
}
public static ByteBuffer fetch(URL url, long ifModifiedSince, Object etag, Map<String, String> requestParameters, Map<String, List<String>> responseParameters) throws IOException {
URLConnection connection = url.openConnection();