From fa986a4d46d21076914876944bedfb3fe4d3d807 Mon Sep 17 00:00:00 2001 From: Gintas Grigelionis Date: Tue, 26 Jun 2018 18:36:54 +0200 Subject: [PATCH 1/3] No need to force Latin-1 --- manual/credits.html | 1 - 1 file changed, 1 deletion(-) diff --git a/manual/credits.html b/manual/credits.html index d45c5bc52..03d82919a 100644 --- a/manual/credits.html +++ b/manual/credits.html @@ -18,7 +18,6 @@ - Apache Ant User Manual - Credits From 9e395140343025ec7a5e738a28e364fbd749c0cc Mon Sep 17 00:00:00 2001 From: Jaikiran Pai Date: Thu, 28 Jun 2018 10:27:26 +0530 Subject: [PATCH 2/3] bz-62499 Revert the change which caused regression in "get" task. Plus introduce a test case to reproduce the issue and verify the fix --- .../org/apache/tools/ant/taskdefs/Get.java | 41 +++++++++++-------- src/tests/antunit/taskdefs/get-test.xml | 9 ++++ 2 files changed, 32 insertions(+), 18 deletions(-) diff --git a/src/main/org/apache/tools/ant/taskdefs/Get.java b/src/main/org/apache/tools/ant/taskdefs/Get.java index 13f610c53..1d4ba4f83 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Get.java +++ b/src/main/org/apache/tools/ant/taskdefs/Get.java @@ -669,29 +669,34 @@ public class Get extends Task { 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); } - 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 { diff --git a/src/tests/antunit/taskdefs/get-test.xml b/src/tests/antunit/taskdefs/get-test.xml index a8ca6a911..b4543f579 100644 --- a/src/tests/antunit/taskdefs/get-test.xml +++ b/src/tests/antunit/taskdefs/get-test.xml @@ -122,4 +122,13 @@ + + + + + + + + From 3cbf031b851a280e34ff59260307ee49e077869d Mon Sep 17 00:00:00 2001 From: Jaikiran Pai Date: Thu, 28 Jun 2018 10:30:11 +0530 Subject: [PATCH 3/3] Update WHATSNEW for bz-62499 --- WHATSNEW | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/WHATSNEW b/WHATSNEW index 1c2d0ca83..527d0e291 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -1,6 +1,14 @@ Changes from Ant 1.9.12 TO Ant 1.9.13 ===================================== +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.9.11 TO Ant 1.9.12 =====================================