reset eepget length variable after a redirect

This commit is contained in:
zzz
2010-10-06 01:11:21 +00:00
parent 895c9a33a9
commit 09d1eb17d4
2 changed files with 19 additions and 0 deletions

View File

@ -537,6 +537,15 @@ public class EepGet {
if (_redirects > 5)
throw new IOException("Too many redirects: 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);
doFetch(timeout);
return;

View File

@ -116,6 +116,7 @@ public class EepHead extends EepGet {
else
timeout.setInactivityTimeout(60*1000);
// Should we even follow redirects for HEAD?
if (_redirectLocation != null) {
//try {
URL oldURL = new URL(_actualURL);
@ -143,6 +144,15 @@ public class EepHead extends EepGet {
if (_redirects > 5)
throw new IOException("Too many redirects: 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);
doFetch(timeout);
return;