diff --git a/WHATSNEW b/WHATSNEW index abbf2b85e..92f1c5096 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -1,6 +1,13 @@ Changes from Ant 1.10.11 TO Ant 1.10.12 ======================================= +Fixed bugs: +----------- + + * The http condition would follow redirects even when "followRedirects" attribute + was set to "false". This has now been fixed. + Bugzilla Report 65489 + Other changes: -------------- diff --git a/src/main/org/apache/tools/ant/taskdefs/condition/Http.java b/src/main/org/apache/tools/ant/taskdefs/condition/Http.java index a047decc5..c7df1225f 100644 --- a/src/main/org/apache/tools/ant/taskdefs/condition/Http.java +++ b/src/main/org/apache/tools/ant/taskdefs/condition/Http.java @@ -149,7 +149,7 @@ public class Http extends ProjectComponent implements Condition { http.setInstanceFollowRedirects(followRedirects); http.setReadTimeout(readTimeout); final int firstStatusCode = http.getResponseCode(); - if (Get.isMoved(firstStatusCode)) { + if (this.followRedirects && Get.isMoved(firstStatusCode)) { final String newLocation = http.getHeaderField("Location"); final URL newURL = new URL(newLocation); if (redirectionAllowed(url, newURL)) { diff --git a/src/tests/antunit/taskdefs/condition/http-test.xml b/src/tests/antunit/taskdefs/condition/http-test.xml index 91ec866bd..1b9f133e1 100644 --- a/src/tests/antunit/taskdefs/condition/http-test.xml +++ b/src/tests/antunit/taskdefs/condition/http-test.xml @@ -68,4 +68,38 @@ text="Result code for ${unsecurelocation} was 200" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +