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:
parent
b8f596c064
commit
ee11696457
@ -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));
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user