You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2009/06/27 03:39:12 UTC
DO NOT REPLY [Bug 47433] Issue with "get" task to download a
redirected/moved URL (301/302)
https://issues.apache.org/bugzilla/show_bug.cgi?id=47433
--- Comment #1 from Jagadesh Munta <ja...@sun.com> 2009-06-26 18:39:10 PST ---
Earlier code (calling execute after setting new URL) had issue on Linux and
modified to call doGet() method.
Below is the latest code (last line changed).
int responseCode = httpConnection.getResponseCode();
log("Response Code="+responseCode, logLevel);
// test for 401 result (HTTP only)
if (responseCode == HttpURLConnection.HTTP_UNAUTHORIZED) {
String message = "HTTP Authorization failure";
if (ignoreErrors) {
log(message, logLevel);
return false;
} else {
throw new BuildException(message);
}
} else if ((responseCode == HttpURLConnection.HTTP_MOVED_PERM) ||
(responseCode == HttpURLConnection.HTTP_MOVED_TEMP)) {
String newLocation = httpConnection.getHeaderField("Location");
String message = "HTTP URL Moved to "+newLocation;
log(message, logLevel);
setSrc(new URL(newLocation));
return doGet(logLevel, progress);
}
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.