forked from I2P_Developers/i2p.i2p
* Reseed: Send If-Modified-Since in fetches
* EepGet: Fixes for adding etag or lastmod headers before fetch
This commit is contained in:
@@ -575,7 +575,6 @@ public class Reseeder {
|
||||
/** @return null on error */
|
||||
private byte[] readURL(URL url) throws IOException {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream(4*1024);
|
||||
|
||||
EepGet get;
|
||||
boolean ssl = url.toString().startsWith("https");
|
||||
if (ssl) {
|
||||
@@ -603,6 +602,10 @@ public class Reseeder {
|
||||
get.addAuthorization(user, pass);
|
||||
}
|
||||
}
|
||||
if (!url.toString().endsWith("/")) {
|
||||
String minLastMod = RFC822Date.to822Date(_context.clock().now() - MAX_FILE_AGE);
|
||||
get.addHeader("If-Modified-Since", minLastMod);
|
||||
}
|
||||
get.addStatusListener(ReseedRunner.this);
|
||||
if (get.fetch() && get.getStatusCode() == 200)
|
||||
return baos.toByteArray();
|
||||
@@ -644,6 +647,10 @@ public class Reseeder {
|
||||
get.addAuthorization(user, pass);
|
||||
}
|
||||
}
|
||||
if (!url.toString().endsWith("/")) {
|
||||
String minLastMod = RFC822Date.to822Date(_context.clock().now() - MAX_FILE_AGE);
|
||||
get.addHeader("If-Modified-Since", minLastMod);
|
||||
}
|
||||
get.addStatusListener(ReseedRunner.this);
|
||||
if (get.fetch() && get.getStatusCode() == 200)
|
||||
return out;
|
||||
|
Reference in New Issue
Block a user