This is an automated email from the ASF dual-hosted git repository.
rohit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/master by this push:
new f86a7a0 utils: removed port check for url validation (#2802) (#3254)
f86a7a0 is described below
commit f86a7a058b2ac3dd96417fe9bd597b6ec4765f38
Author: Abhishek Kumar <[email protected]>
AuthorDate: Mon Apr 8 14:16:14 2019 +0530
utils: removed port check for url validation (#2802) (#3254)
This allows urls with ports other thatn 80 and 443
Signed-off-by: Abhishek Kumar <[email protected]>
---
utils/src/main/java/com/cloud/utils/UriUtils.java | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/utils/src/main/java/com/cloud/utils/UriUtils.java
b/utils/src/main/java/com/cloud/utils/UriUtils.java
index b3ec464..6a580ca 100644
--- a/utils/src/main/java/com/cloud/utils/UriUtils.java
+++ b/utils/src/main/java/com/cloud/utils/UriUtils.java
@@ -31,15 +31,16 @@ import java.net.URLEncoder;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
import java.util.List;
import java.util.ListIterator;
-import java.util.StringTokenizer;
import java.util.Map;
-import java.util.HashMap;
-import java.util.Comparator;
+import java.util.StringTokenizer;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
+
import org.apache.commons.httpclient.Credentials;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
@@ -53,18 +54,17 @@ import org.apache.commons.httpclient.util.URIUtil;
import org.apache.http.NameValuePair;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.client.utils.URLEncodedUtils;
-
import org.apache.http.message.BasicNameValuePair;
import org.apache.log4j.Logger;
-
-import com.cloud.utils.crypt.DBEncryptionUtil;
-import com.cloud.utils.exception.CloudRuntimeException;
-import com.google.common.base.Strings;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
-import org.w3c.dom.NamedNodeMap;
+
+import com.cloud.utils.crypt.DBEncryptionUtil;
+import com.cloud.utils.exception.CloudRuntimeException;
+import com.google.common.base.Strings;
public class UriUtils {
@@ -264,11 +264,8 @@ public class UriUtils {
(!uri.getScheme().equalsIgnoreCase("http") &&
!uri.getScheme().equalsIgnoreCase("https") &&
!uri.getScheme().equalsIgnoreCase("file"))) {
throw new IllegalArgumentException("Unsupported scheme for
url: " + url);
}
- int port = uri.getPort();
- if (!(port == 80 || port == 8080 || port == 443 || port == -1)) {
- throw new IllegalArgumentException("Only ports 80, 8080 and
443 are allowed");
- }
+ int port = uri.getPort();
if (port == -1 && uri.getScheme().equalsIgnoreCase("https")) {
port = 443;
} else if (port == -1 && uri.getScheme().equalsIgnoreCase("http"))
{