Browse Source

Merge changes from 1.9.x branch

master
Jaikiran Pai 7 years ago
parent
commit
19e263a7dd
4 changed files with 41 additions and 19 deletions
  1. +8
    -0
      WHATSNEW
  2. +1
    -1
      manual/credits.html
  3. +23
    -18
      src/main/org/apache/tools/ant/taskdefs/Get.java
  4. +9
    -0
      src/tests/antunit/taskdefs/get-test.xml

+ 8
- 0
WHATSNEW View File

@@ -1,6 +1,14 @@
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
=====================================



+ 1
- 1
manual/credits.html View File

@@ -19,7 +19,7 @@
<head>
<meta http-equiv="Content-Language" content="en-us">
<link rel="stylesheet" type="text/css" href="stylesheets/style.css">
<title>Apache Ant User Manual&mdash;Credits</title>
<title>Apache Ant User Manual - Credits</title>
</head>

<body>


+ 23
- 18
src/main/org/apache/tools/ant/taskdefs/Get.java View File

@@ -693,29 +693,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 {


+ 9
- 0
src/tests/antunit/taskdefs/get-test.xml View File

@@ -122,4 +122,13 @@
</au:assertTrue>
<au:assertLogContains text="local.cgi moved to http" />
</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>

Loading…
Cancel
Save