I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 09d1eb17 authored by zzz's avatar zzz
Browse files

reset eepget length variable after a redirect

parent 895c9a33
No related branches found
No related tags found
No related merge requests found
...@@ -537,6 +537,15 @@ public class EepGet { ...@@ -537,6 +537,15 @@ public class EepGet {
if (_redirects > 5) if (_redirects > 5)
throw new IOException("Too many redirects: to " + _redirectLocation); throw new IOException("Too many redirects: to " + _redirectLocation);
if (_log.shouldLog(Log.INFO)) _log.info("Redirecting to " + _redirectLocation); if (_log.shouldLog(Log.INFO)) _log.info("Redirecting to " + _redirectLocation);
// reset some important variables, we don't want to save the values from the redirect
_bytesRemaining = -1;
_redirectLocation = null;
_etag = null;
_lastModified = null;
_contentType = null;
_encodingChunked = false;
sendRequest(timeout); sendRequest(timeout);
doFetch(timeout); doFetch(timeout);
return; return;
......
...@@ -116,6 +116,7 @@ public class EepHead extends EepGet { ...@@ -116,6 +116,7 @@ public class EepHead extends EepGet {
else else
timeout.setInactivityTimeout(60*1000); timeout.setInactivityTimeout(60*1000);
// Should we even follow redirects for HEAD?
if (_redirectLocation != null) { if (_redirectLocation != null) {
//try { //try {
URL oldURL = new URL(_actualURL); URL oldURL = new URL(_actualURL);
...@@ -143,6 +144,15 @@ public class EepHead extends EepGet { ...@@ -143,6 +144,15 @@ public class EepHead extends EepGet {
if (_redirects > 5) if (_redirects > 5)
throw new IOException("Too many redirects: to " + _redirectLocation); throw new IOException("Too many redirects: to " + _redirectLocation);
if (_log.shouldLog(Log.INFO)) _log.info("Redirecting to " + _redirectLocation); if (_log.shouldLog(Log.INFO)) _log.info("Redirecting to " + _redirectLocation);
// reset some important variables, we don't want to save the values from the redirect
_bytesRemaining = -1;
_redirectLocation = null;
_etag = null;
_lastModified = null;
_contentType = null;
_encodingChunked = false;
sendRequest(timeout); sendRequest(timeout);
doFetch(timeout); doFetch(timeout);
return; return;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment