You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ra...@apache.org on 2016/11/04 11:12:32 UTC

[1/2] git commit: updated refs/heads/4.9 to f19a163

Repository: cloudstack
Updated Branches:
  refs/heads/4.9 240f44392 -> f19a1631a


SSVM downloader now handles redirects properly.

Previously it was using the HttpClient to make an initial request
to an ISO. This would follow redirects. Then it would make
another request using built-in Java URL and InputStream, which
doesn't follow redirects. This results in the ISO getting stuck
at 0% forever and also causing DOS effects.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/7a4220f1
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/7a4220f1
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/7a4220f1

Branch: refs/heads/4.9
Commit: 7a4220f17252d54a1b990c776d1378400652b0ab
Parents: 305400b
Author: jeff <je...@greenqloud.com>
Authored: Fri Jul 8 09:59:08 2016 +0000
Committer: jeff <je...@greenqloud.com>
Committed: Tue Nov 1 10:48:53 2016 +0000

----------------------------------------------------------------------
 .../src/com/cloud/storage/template/HttpTemplateDownloader.java | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7a4220f1/core/src/com/cloud/storage/template/HttpTemplateDownloader.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/storage/template/HttpTemplateDownloader.java b/core/src/com/cloud/storage/template/HttpTemplateDownloader.java
index 76d1ac9..bdf4990 100644
--- a/core/src/com/cloud/storage/template/HttpTemplateDownloader.java
+++ b/core/src/com/cloud/storage/template/HttpTemplateDownloader.java
@@ -25,7 +25,6 @@ import java.io.InputStream;
 import java.io.RandomAccessFile;
 import java.net.URI;
 import java.net.URISyntaxException;
-import java.net.URL;
 import java.util.Date;
 
 import org.apache.cloudstack.utils.imagestore.ImageStoreUtil;
@@ -117,7 +116,7 @@ public class HttpTemplateDownloader extends ManagedContextRunnable implements Te
             request = new GetMethod(downloadUrl);
             request.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, myretryhandler);
             completionCallback = callback;
-            //this.request.setFollowRedirects(false);
+            this.request.setFollowRedirects(true);
 
             File f = File.createTempFile("dnld", "tmp_", new File(toDir));
 
@@ -232,8 +231,7 @@ public class HttpTemplateDownloader extends ManagedContextRunnable implements Te
                 remoteSize = maxTemplateSizeInBytes;
             }
 
-            URL url = new URL(getDownloadUrl());
-            InputStream in = url.openStream();
+            InputStream in = request.getResponseBodyAsStream();
 
             RandomAccessFile out = new RandomAccessFile(file, "rw");
             out.seek(localFileSize);


[2/2] git commit: updated refs/heads/4.9 to f19a163

Posted by ra...@apache.org.
Merge pull request #1746 from greenqloud/pr-iso-follow-redirects-4.9

SSVM downloader now handles redirects properly.New version of #1607, opened against 4.9 so it can be forward merged.

**Original Description**
Previously it was using the HttpClient to make an initial request to an ISO. This would follow redirects. Then it would make another request using built-in Java URL and InputStream, which doesn't follow redirects. This results in the ISO getting stuck at 0% forever and also causing DOS effects.

* pr/1746:
  SSVM downloader now handles redirects properly.

Signed-off-by: Rajani Karuturi <ra...@accelerite.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/f19a1631
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/f19a1631
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/f19a1631

Branch: refs/heads/4.9
Commit: f19a1631a5770d1806174e82bd32a1488a021a3f
Parents: 240f443 7a4220f
Author: Rajani Karuturi <ra...@accelerite.com>
Authored: Fri Nov 4 16:41:38 2016 +0530
Committer: Rajani Karuturi <ra...@accelerite.com>
Committed: Fri Nov 4 16:41:38 2016 +0530

----------------------------------------------------------------------
 .../src/com/cloud/storage/template/HttpTemplateDownloader.java | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
----------------------------------------------------------------------