https://bz.apache.org/bugzilla/show_bug.cgi?id=62499

            Bug ID: 62499
           Summary: Regression: redirection from HTTP to HTTPS is no
                    longer supported by Get task
           Product: Ant
           Version: 1.9.12
          Hardware: PC
            Status: NEW
          Severity: regression
          Priority: P2
         Component: Core tasks
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

The <get> task no longer follows redirects from http: to https:, but instead
fails the build with the following message:

"Redirection detected from http to https. Protocol switch unsafe, not allowed."

See bug 62164 (filed against Apache Tomcat) for an example.

Looking into the source code I found that

1. This error message is printed by get task, Get.redirectionAllowed().

2. The condition that triggers this message was broken by the following commit:
in 1.9.x:
Revision: 5eef12a964e1813763c4a0ab6a056edcfa768814
Author: Gintas Grigelionis <[email protected]>
Date: 12.12.2017 1:30:20
Message:
Checkstyle: whitespace, line continuation and modifier idiosyncrasies

in master:
Revision: 7f1e7628b357082fb1f786d1f58156a336db45e3
Author: Gintas Grigelionis <[email protected]>
Date: 12.12.2017 1:30:20
Message:
Checkstyle: whitespace, line continuation and modifier idiosyncrasies


Original code of redirectionAllowed(), e.g. Ant 1.9.9:
https://github.com/apache/ant/blob/rel/1.9.9/src/main/org/apache/tools/ant/taskdefs/Get.java#L669

Current code, e.g. Ant 1.9.12:
https://github.com/apache/ant/blob/rel/1.9.12/src/main/org/apache/tools/ant/taskdefs/Get.java#L671


Current condition:
 if (aSource.getProtocol().equals(aDest.getProtocol())
   && (HTTP.equals(aSource.getProtocol()) ||
HTTPS.equals(aDest.getProtocol()))) {

Correct condition would be:
 if (aSource.getProtocol().equals(aDest.getProtocol())
   || (HTTP.equals(aSource.getProtocol()) &&
HTTPS.equals(aDest.getProtocol()))) {


Broken versions: Ant 1.9.10 - 1.9.12 and 1.10.2 - 1.10.4.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to