@@ -1,6 +1,14 @@ | |||||
Changes from Ant 1.10.4 TO Ant 1.10.5 | Changes from Ant 1.10.4 TO Ant 1.10.5 | ||||
===================================== | ===================================== | ||||
Fixed bugs: | |||||
----------- | |||||
* Fixes a regression in the "get" task where redirects | |||||
from a HTTP resource to a HTTPS resource started throwing | |||||
an exception. | |||||
Bugzilla Report 62499 | |||||
Changes from Ant 1.10.3 TO Ant 1.10.4 | Changes from Ant 1.10.3 TO Ant 1.10.4 | ||||
===================================== | ===================================== | ||||
@@ -19,7 +19,7 @@ | |||||
<head> | <head> | ||||
<meta http-equiv="Content-Language" content="en-us"> | <meta http-equiv="Content-Language" content="en-us"> | ||||
<link rel="stylesheet" type="text/css" href="stylesheets/style.css"> | <link rel="stylesheet" type="text/css" href="stylesheets/style.css"> | ||||
<title>Apache Ant User Manual—Credits</title> | |||||
<title>Apache Ant User Manual - Credits</title> | |||||
</head> | </head> | ||||
<body> | <body> | ||||
@@ -693,29 +693,34 @@ public class Get extends Task { | |||||
private boolean redirectionAllowed(final URL aSource, final URL aDest) { | private boolean redirectionAllowed(final URL aSource, final URL aDest) { | ||||
if (aSource.getProtocol().equals(aDest.getProtocol()) | |||||
&& (HTTP.equals(aSource.getProtocol()) || HTTPS.equals(aDest.getProtocol()))) { | |||||
redirections++; | |||||
if (redirections > REDIRECT_LIMIT) { | |||||
final String message = "More than " + REDIRECT_LIMIT | |||||
+ " times redirected, giving up"; | |||||
if (ignoreErrors) { | |||||
log(message, logLevel); | |||||
return false; | |||||
} | |||||
if (!(aSource.getProtocol().equals(aDest.getProtocol()) || (HTTP | |||||
.equals(aSource.getProtocol()) && HTTPS.equals(aDest | |||||
.getProtocol())))) { | |||||
final String message = "Redirection detected from " | |||||
+ aSource.getProtocol() + " to " + aDest.getProtocol() | |||||
+ ". Protocol switch unsafe, not allowed."; | |||||
if (ignoreErrors) { | |||||
log(message, logLevel); | |||||
return false; | |||||
} else { | |||||
throw new BuildException(message); | throw new BuildException(message); | ||||
} | } | ||||
return true; | |||||
} | } | ||||
final String message = "Redirection detected from " | |||||
+ aSource.getProtocol() + " to " + aDest.getProtocol() | |||||
+ ". Protocol switch unsafe, not allowed."; | |||||
if (ignoreErrors) { | |||||
log(message, logLevel); | |||||
return false; | |||||
redirections++; | |||||
if (redirections > REDIRECT_LIMIT) { | |||||
final String message = "More than " + REDIRECT_LIMIT | |||||
+ " times redirected, giving up"; | |||||
if (ignoreErrors) { | |||||
log(message, logLevel); | |||||
return false; | |||||
} else { | |||||
throw new BuildException(message); | |||||
} | |||||
} | } | ||||
throw new BuildException(message); | |||||
return true; | |||||
} | } | ||||
private URLConnection openConnection(final URL aSource) throws IOException { | private URLConnection openConnection(final URL aSource) throws IOException { | ||||
@@ -122,4 +122,13 @@ | |||||
</au:assertTrue> | </au:assertTrue> | ||||
<au:assertLogContains text="local.cgi moved to http" /> | <au:assertLogContains text="local.cgi moved to http" /> | ||||
</target> | </target> | ||||
<target name="testHttpToHttpsRedirect" description="Tests that a resource that's redirected | |||||
from HTTP to HTTPS works without an error. See bugzilla-62499 for details"> | |||||
<get src="${location}/http-to-https.txt" dest="${output}/http-to-https-redirect.tmp"/> | |||||
<au:assertFileExists file="${output}/http-to-https-redirect.tmp"/> | |||||
<au:assertTrue> | |||||
<resourcecontains resource="${output}/http-to-https-redirect.tmp" substring="hello world"/> | |||||
</au:assertTrue> | |||||
</target> | |||||
</project> | </project> |