@@ -1,6 +1,13 @@ | |||||
Changes from Ant 1.10.11 TO Ant 1.10.12 | 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: | Other changes: | ||||
-------------- | -------------- | ||||
@@ -149,7 +149,7 @@ public class Http extends ProjectComponent implements Condition { | |||||
http.setInstanceFollowRedirects(followRedirects); | http.setInstanceFollowRedirects(followRedirects); | ||||
http.setReadTimeout(readTimeout); | http.setReadTimeout(readTimeout); | ||||
final int firstStatusCode = http.getResponseCode(); | final int firstStatusCode = http.getResponseCode(); | ||||
if (Get.isMoved(firstStatusCode)) { | |||||
if (this.followRedirects && Get.isMoved(firstStatusCode)) { | |||||
final String newLocation = http.getHeaderField("Location"); | final String newLocation = http.getHeaderField("Location"); | ||||
final URL newURL = new URL(newLocation); | final URL newURL = new URL(newLocation); | ||||
if (redirectionAllowed(url, newURL)) { | if (redirectionAllowed(url, newURL)) { | ||||
@@ -68,4 +68,38 @@ | |||||
text="Result code for ${unsecurelocation} was 200" /> | text="Result code for ${unsecurelocation} was 200" /> | ||||
</target> | </target> | ||||
<target name="testDontFollowPermanentRedirect"> | |||||
<sleep milliseconds="250"/> | |||||
<au:assertTrue> | |||||
<http url="${location}/permanent.txt" followRedirects="false"/> | |||||
</au:assertTrue> | |||||
<au:assertLogContains level="verbose" | |||||
text="Result code for ${location}/permanent.txt was 301" /> | |||||
</target> | |||||
<target name="testDontFollowTemporaryRedirect"> | |||||
<sleep milliseconds="250"/> | |||||
<au:assertTrue> | |||||
<http url="${location}/temp.txt" followRedirects="false"/> | |||||
</au:assertTrue> | |||||
<au:assertLogContains level="verbose" | |||||
text="Result code for ${location}/temp.txt was 302" /> | |||||
</target> | |||||
<target name="testDontFollowStatusCode307Redirect"> | |||||
<sleep milliseconds="250"/> | |||||
<au:assertTrue> | |||||
<http url="${location}/307.txt" followRedirects="false"/> | |||||
</au:assertTrue> | |||||
<au:assertLogContains level="verbose" | |||||
text="Result code for ${location}/307.txt was 307" /> | |||||
</target> | |||||
<target name="testDontFollowHttpToHttpsRedirect"> | |||||
<sleep milliseconds="250"/> | |||||
<au:assertTrue> | |||||
<http url="${unsecurelocation}" followRedirects="false"/> | |||||
</au:assertTrue> | |||||
</target> | |||||
</project> | </project> |