CVE-2021-29061: Allocation of Resources Without Limits or Throttling (CWE-770)
value: A Regular Expression Denial of Service (ReDOS) vulnerability was discovered in Vfsjfilechooser2 version 0.2.9 and below which occurs when the application attempts to validate crafted URIs.
CWE description: The product allocates a reusable resource or group of resources on behalf of an actor without imposing any restrictions on the size or number of resources that can be allocated, in violation of the intended security policy for that actor.
CVSS v3 base score: 7.5
Published: 2021-06-21T20:15Z
Repository: https://github.com/fracpete/vfsjfilechooser2
Language: Java
Files changed: src/main/java/com/googlecode/vfsjfilechooser2/utils/VFSURIValidator.java
Commit date: 2020-10-07 10:18:37 +1300
Commit message: incorporated Yeting Li's fix for Potential Regex Denial of Service (ReDoS), see https://github.com/fracpete/vfsjfilechooser2/issues/7
passwords can now also contain special characters (eg :), which have to be URL encoded (ie %3A)

Diff: diff --git a/src/main/java/com/googlecode/vfsjfilechooser2/utils/VFSURIValidator.java b/src/main/java/com/googlecode/vfsjfilechooser2/utils/VFSURIValidator.java
index a635413..3e2aad5 100644
--- a/src/main/java/com/googlecode/vfsjfilechooser2/utils/VFSURIValidator.java
+++ b/src/main/java/com/googlecode/vfsjfilechooser2/utils/VFSURIValidator.java
@@ -1,9 +1,11 @@
 /*
  * VFS URIs validator
  *
  * Copyright (C) 2008 Stan Love
+ * Copyright (C) 2020 University of Waikato, Hamilton, NZ
+ * Copyright (C) 2020 Yeting Li
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -231,15 +233,15 @@ public class VFSURIValidator {
 		}
 		//ftp://(username:pass)*?@hostname(:[0-9]+)*?/.*
 		//        "(ftp|FTP|sftp|SFTP|http|HTTP|https|HTTPS|webdav|WEBDAV|smb|SMB)://(.*?:.*?@)*([^:]+)([ 	]*:[0-9]+)*([ 	]*:)*(/.*)");
 		//"(ftp|FTP|sftp|SFTP|http|HTTP|https|HTTPS|webdav|WEBDAV|smb|SMB)://(.+:.+@)*([^:]+)([ 	]*:[0-9]+)*([ 	]*:)*(/.*)");
 		Pattern p_ftp2 = Pattern
-				.compile("(ftp|FTP|sftp|SFTP|http|HTTP|https|HTTPS|webdav|WEBDAV|smb|SMB)://(.+:.+@)*([^:]+?/*)([ 	]*:[0-9]+)*([ 	]*:)*(/.*)");
+				.compile("(ftp|FTP|sftp|SFTP|http|HTTP|https|HTTPS|webdav|WEBDAV|smb|SMB)://([^:@]+:[^:@]+@)*([^:]+?/*)([ ]*:[0-9]+)*([ ]*:)*(/.*)");
 		Matcher m_ftp2 = p_ftp2.matcher(_uri);
 
 		Pattern p_ftp3 = Pattern
-				.compile("(ftp|FTP|sftp|SFTP|http|HTTP|https|HTTPS|webdav|WEBDAV|smb|SMB)://(.+:.+@)*([^:]+)([ 	]*:[0-9]+)*([ 	]*:)*(/*?.*)");
+				.compile("(ftp|FTP|sftp|SFTP|http|HTTP|https|HTTPS|webdav|WEBDAV|smb|SMB)://([^:@]+:[^:@]+@)*([^:]+)([ 	]*:[0-9]+)*([ 	]*:)*(/*?.*)");
 		Matcher m_ftp3 = p_ftp3.matcher(_uri);
 
 		if (m_ftp2.matches()) {
 			//System.out.println("ftp2 matcher");
 			ret = true;
@@ -342,10 +344,30 @@ public class VFSURIValidator {
 				local_pass = local_pass.substring(0, local_pass.length() - 1);
 			}
 			if (local_pass.startsWith(":")) {
 				local_pass = local_pass.substring(1);
 			}
+			// decode specials chars (URL encoded %XY)
+			if (local_pass.contains("%")) {
+				String tmp_local_pass = local_pass;
+				StringBuilder new_local_pass = new StringBuilder();
+				while (tmp_local_pass.contains("%")) {
+					new_local_pass.append(tmp_local_pass.substring(0, tmp_local_pass.indexOf('%')));
+					tmp_local_pass = tmp_local_pass.substring(tmp_local_pass.indexOf('%'));
+					if (tmp_local_pass.length() >= 3) {
+						char c = (char) Integer.parseInt(tmp_local_pass.substring(1, 3), 16);
+						new_local_pass.append(c);
+						tmp_local_pass = tmp_local_pass.substring(3);
+					}
+					else {
+						break;
+					}
+				}
+				if (!tmp_local_pass.isEmpty())
+					new_local_pass.append(tmp_local_pass);
+				local_pass = new_local_pass.toString();
+			}
 		}
 		local_hostname = hostname;
 		local_port = port;
 		local_file = file;
 
@@ -821,30 +843,30 @@ public class VFSURIValidator {
 		v.assertNull(v.getHostname());
 		v.assertNull(v.getPassword());
 		v.assertNull(v.getPort());
 		v.assertNull(v.getFile());
 
-		s = "ftp://user:pass:@machine/the_file"; //can ":" be part of a password?
+		s = "ftp://user:pass%3Aa@machine/the_file"; //if ":" is part of a password, it must be encoded (: -> %3A)
 
 		if (!v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertEquals(v.getProtocol(), "ftp");
 		v.assertEquals(v.getUser(), "user");
-		v.assertEquals(v.getPassword(), "pass:");
+		v.assertEquals(v.getPassword(), "pass:a");
 		v.assertEquals(v.getHostname(), "machine");
 		v.assertNull(v.getPort());
 		v.assertEquals(v.getFile(), "/the_file");
 
-		s = "ftp://user:pass:@machine/the_dir/";
+		s = "ftp://user:pass%3A%3a@machine/the_dir/";
 
 		if (!v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertEquals(v.getProtocol(), "ftp");
 		v.assertEquals(v.getUser(), "user");
-		v.assertEquals(v.getPassword(), "pass:");
+		v.assertEquals(v.getPassword(), "pass::");
 		v.assertEquals(v.getHostname(), "machine");
 		v.assertNull(v.getPort());
 		v.assertEquals(v.getFile(), "/the_dir/");
 
 		s = "ftp: //user:pass:@machine/the_file"; //failure tests
@@ -990,11 +1012,11 @@ public class VFSURIValidator {
 		v.assertNull(v.getHostname());
 		v.assertNull(v.getPassword());
 		v.assertNull(v.getPort());
 		v.assertNull(v.getFile());
 
-		s = "FTP://user:pass:@machine/the_file"; //can ":" be part of a password?
+		s = "FTP://user:pass%3A@machine/the_file"; //if ":" is part of a password, it must be encoded (: -> %3A)
 
 		if (!v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertEquals(v.getProtocol(), "FTP");
@@ -1002,11 +1024,11 @@ public class VFSURIValidator {
 		v.assertEquals(v.getPassword(), "pass:");
 		v.assertEquals(v.getHostname(), "machine");
 		v.assertNull(v.getPort());
 		v.assertEquals(v.getFile(), "/the_file");
 
-		s = "FTP://user:pass:@machine/the_dir/";
+		s = "FTP://user:pass%3A@machine/the_dir/";
 
 		if (!v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertEquals(v.getProtocol(), "FTP");
@@ -1159,11 +1181,11 @@ public class VFSURIValidator {
 		v.assertNull(v.getHostname());
 		v.assertNull(v.getPassword());
 		v.assertNull(v.getPort());
 		v.assertNull(v.getFile());
 
-		s = "sftp://user:pass:@machine/the_file"; //can ":" be part of a password?
+		s = "sftp://user:pass%3A@machine/the_file"; //if ":" is part of a password, it must be encoded (: -> %3A)
 
 		if (!v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertEquals(v.getProtocol(), "sftp");
@@ -1171,11 +1193,11 @@ public class VFSURIValidator {
 		v.assertEquals(v.getPassword(), "pass:");
 		v.assertEquals(v.getHostname(), "machine");
 		v.assertNull(v.getPort());
 		v.assertEquals(v.getFile(), "/the_file");
 
-		s = "sftp://user:pass:@machine/the_dir/";
+		s = "sftp://user:pass%3A@machine/the_dir/";
 
 		if (!v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertEquals(v.getProtocol(), "sftp");
@@ -1183,11 +1205,11 @@ public class VFSURIValidator {
 		v.assertEquals(v.getPassword(), "pass:");
 		v.assertEquals(v.getHostname(), "machine");
 		v.assertNull(v.getPort());
 		v.assertEquals(v.getFile(), "/the_dir/");
 
-		s = "sftp: //user:pass:@machine/the_file"; //failure tests
+		s = "sftp: //user:pass%3A@machine/the_file"; //failure tests
 
 		if (v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertNull(v.getProtocol());
@@ -1195,11 +1217,11 @@ public class VFSURIValidator {
 		v.assertNull(v.getHostname());
 		v.assertNull(v.getPassword());
 		v.assertNull(v.getPort());
 		v.assertNull(v.getFile());
 
-		s = "sftp:/ /user:pass:@machine/the_file";
+		s = "sftp:/ /user:pass%3A@machine/the_file";
 
 		if (v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertNull(v.getProtocol());
@@ -1207,11 +1229,11 @@ public class VFSURIValidator {
 		v.assertNull(v.getHostname());
 		v.assertNull(v.getPassword());
 		v.assertNull(v.getPort());
 		v.assertNull(v.getFile());
 
-		s = "sftp:/ /user:pass:@machine";
+		s = "sftp:/ /user:pass%3A@machine";
 
 		if (v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertNull(v.getProtocol());
@@ -1219,11 +1241,11 @@ public class VFSURIValidator {
 		v.assertNull(v.getHostname());
 		v.assertNull(v.getPassword());
 		v.assertNull(v.getPort());
 		v.assertNull(v.getFile());
 
-		s = "sftp://user:pass:@:123/a";
+		s = "sftp://user:pass%3A@:123/a";
 
 		if (v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertNull(v.getProtocol());
@@ -1231,11 +1253,11 @@ public class VFSURIValidator {
 		v.assertNull(v.getHostname());
 		v.assertNull(v.getPassword());
 		v.assertNull(v.getPort());
 		v.assertNull(v.getFile());
 
-		s = "sftp://user:pass:@machine:a/the_file";
+		s = "sftp://user:pass%3A@machine:a/the_file";
 
 		if (v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertNull(v.getProtocol());
@@ -1327,11 +1349,11 @@ public class VFSURIValidator {
 		v.assertNull(v.getHostname());
 		v.assertNull(v.getPassword());
 		v.assertNull(v.getPort());
 		v.assertNull(v.getFile());
 
-		s = "SFTP://user:pass:@machine/the_file"; //can ":" be part of a password?
+		s = "SFTP://user:pass%3A@machine/the_file"; //if ":" is part of a password, it must be encoded (: -> %3A)
 
 		if (!v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertEquals(v.getProtocol(), "SFTP");
@@ -1339,11 +1361,11 @@ public class VFSURIValidator {
 		v.assertEquals(v.getPassword(), "pass:");
 		v.assertEquals(v.getHostname(), "machine");
 		v.assertNull(v.getPort());
 		v.assertEquals(v.getFile(), "/the_file");
 
-		s = "SFTP://user:pass:@machine/the_dir/";
+		s = "SFTP://user:pass%3A@machine/the_dir/";
 
 		if (!v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertEquals(v.getProtocol(), "SFTP");
@@ -1496,11 +1518,11 @@ public class VFSURIValidator {
 		v.assertNull(v.getHostname());
 		v.assertNull(v.getPassword());
 		v.assertNull(v.getPort());
 		v.assertNull(v.getFile());
 
-		s = "http://user:pass:@machine/the_file"; //can ":" be part of a password?
+		s = "http://user:pass%3A@machine/the_file"; //if ":" is part of a password, it must be encoded (: -> %3A)
 
 		if (!v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertEquals(v.getProtocol(), "http");
@@ -1508,11 +1530,11 @@ public class VFSURIValidator {
 		v.assertEquals(v.getPassword(), "pass:");
 		v.assertEquals(v.getHostname(), "machine");
 		v.assertNull(v.getPort());
 		v.assertEquals(v.getFile(), "/the_file");
 
-		s = "http://user:pass:@machine/the_dir/";
+		s = "http://user:pass%3A@machine/the_dir/";
 
 		if (!v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertEquals(v.getProtocol(), "http");
@@ -1520,11 +1542,11 @@ public class VFSURIValidator {
 		v.assertEquals(v.getPassword(), "pass:");
 		v.assertEquals(v.getHostname(), "machine");
 		v.assertNull(v.getPort());
 		v.assertEquals(v.getFile(), "/the_dir/");
 
-		s = "http: //user:pass:@machine/the_file"; //failure tests
+		s = "http: //user:pass%3A@machine/the_file"; //failure tests
 
 		if (v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertNull(v.getProtocol());
@@ -1532,11 +1554,11 @@ public class VFSURIValidator {
 		v.assertNull(v.getHostname());
 		v.assertNull(v.getPassword());
 		v.assertNull(v.getPort());
 		v.assertNull(v.getFile());
 
-		s = "http:/ /user:pass:@machine/the_file";
+		s = "http:/ /user:pass%3A@machine/the_file";
 
 		if (v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertNull(v.getProtocol());
@@ -1544,11 +1566,11 @@ public class VFSURIValidator {
 		v.assertNull(v.getHostname());
 		v.assertNull(v.getPassword());
 		v.assertNull(v.getPort());
 		v.assertNull(v.getFile());
 
-		s = "http:/ /user:pass:@machine";
+		s = "http:/ /user:pass%3A@machine";
 
 		if (v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertNull(v.getProtocol());
@@ -1556,11 +1578,11 @@ public class VFSURIValidator {
 		v.assertNull(v.getHostname());
 		v.assertNull(v.getPassword());
 		v.assertNull(v.getPort());
 		v.assertNull(v.getFile());
 
-		s = "http://user:pass:@:123/a";
+		s = "http://user:pass%3A@:123/a";
 
 		if (v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertNull(v.getProtocol());
@@ -1568,11 +1590,11 @@ public class VFSURIValidator {
 		v.assertNull(v.getHostname());
 		v.assertNull(v.getPassword());
 		v.assertNull(v.getPort());
 		v.assertNull(v.getFile());
 
-		s = "http://user:pass:@machine:a/the_file";
+		s = "http://user:pass%3A@machine:a/the_file";
 
 		if (v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertNull(v.getProtocol());
@@ -1664,11 +1686,11 @@ public class VFSURIValidator {
 		v.assertNull(v.getHostname());
 		v.assertNull(v.getPassword());
 		v.assertNull(v.getPort());
 		v.assertNull(v.getFile());
 
-		s = "HTTP://user:pass:@machine/the_file"; //can ":" be part of a password?
+		s = "HTTP://user:pass%3A@machine/the_file"; //if ":" is part of a password, it must be encoded (: -> %3A)
 
 		if (!v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertEquals(v.getProtocol(), "HTTP");
@@ -1676,11 +1698,11 @@ public class VFSURIValidator {
 		v.assertEquals(v.getPassword(), "pass:");
 		v.assertEquals(v.getHostname(), "machine");
 		v.assertNull(v.getPort());
 		v.assertEquals(v.getFile(), "/the_file");
 
-		s = "HTTP://user:pass:@machine/the_dir/";
+		s = "HTTP://user:pass%3A@machine/the_dir/";
 
 		if (!v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertEquals(v.getProtocol(), "HTTP");
@@ -1688,11 +1710,11 @@ public class VFSURIValidator {
 		v.assertEquals(v.getPassword(), "pass:");
 		v.assertEquals(v.getHostname(), "machine");
 		v.assertNull(v.getPort());
 		v.assertEquals(v.getFile(), "/the_dir/");
 
-		s = "HTTP: //user:pass:@machine/the_file"; //failure tests
+		s = "HTTP: //user:pass%3A@machine/the_file"; //failure tests
 
 		if (v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertNull(v.getProtocol());
@@ -1700,11 +1722,11 @@ public class VFSURIValidator {
 		v.assertNull(v.getHostname());
 		v.assertNull(v.getPassword());
 		v.assertNull(v.getPort());
 		v.assertNull(v.getFile());
 
-		s = "HTTP:/ /user:pass:@machine/the_file";
+		s = "HTTP:/ /user:pass%3A@machine/the_file";
 
 		if (v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertNull(v.getProtocol());
@@ -1712,11 +1734,11 @@ public class VFSURIValidator {
 		v.assertNull(v.getHostname());
 		v.assertNull(v.getPassword());
 		v.assertNull(v.getPort());
 		v.assertNull(v.getFile());
 
-		s = "HTTP:/ /user:pass:@machine";
+		s = "HTTP:/ /user:pass%3A@machine";
 
 		if (v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertNull(v.getProtocol());
@@ -1724,11 +1746,11 @@ public class VFSURIValidator {
 		v.assertNull(v.getHostname());
 		v.assertNull(v.getPassword());
 		v.assertNull(v.getPort());
 		v.assertNull(v.getFile());
 
-		s = "HTTP://user:pass:@:123/a";
+		s = "HTTP://user:pass%3A@:123/a";
 
 		if (v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertNull(v.getProtocol());
@@ -1736,11 +1758,11 @@ public class VFSURIValidator {
 		v.assertNull(v.getHostname());
 		v.assertNull(v.getPassword());
 		v.assertNull(v.getPort());
 		v.assertNull(v.getFile());
 
-		s = "HTTP://user:pass:@machine:a/the_file";
+		s = "HTTP://user:pass%3A@machine:a/the_file";
 
 		if (v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertNull(v.getProtocol());
@@ -1833,11 +1855,11 @@ public class VFSURIValidator {
 		v.assertNull(v.getHostname());
 		v.assertNull(v.getPassword());
 		v.assertNull(v.getPort());
 		v.assertNull(v.getFile());
 
-		s = "https://user:pass:@machine/the_file"; //can ":" be part of a password?
+		s = "https://user:pass%3A@machine/the_file"; //if ":" is part of a password, it must be encoded (: -> %3A)
 
 		if (!v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertEquals(v.getProtocol(), "https");
@@ -1845,11 +1867,11 @@ public class VFSURIValidator {
 		v.assertEquals(v.getPassword(), "pass:");
 		v.assertEquals(v.getHostname(), "machine");
 		v.assertNull(v.getPort());
 		v.assertEquals(v.getFile(), "/the_file");
 
-		s = "https://user:pass:@machine/the_dir/";
+		s = "https://user:pass%3A@machine/the_dir/";
 
 		if (!v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertEquals(v.getProtocol(), "https");
@@ -1857,11 +1879,11 @@ public class VFSURIValidator {
 		v.assertEquals(v.getPassword(), "pass:");
 		v.assertEquals(v.getHostname(), "machine");
 		v.assertNull(v.getPort());
 		v.assertEquals(v.getFile(), "/the_dir/");
 
-		s = "https: //user:pass:@machine/the_file"; //failure tests
+		s = "https: //user:pass%3A@machine/the_file"; //failure tests
 
 		if (v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertNull(v.getProtocol());
@@ -1869,11 +1891,11 @@ public class VFSURIValidator {
 		v.assertNull(v.getHostname());
 		v.assertNull(v.getPassword());
 		v.assertNull(v.getPort());
 		v.assertNull(v.getFile());
 
-		s = "https:/ /user:pass:@machine/the_file";
+		s = "https:/ /user:pass%3A@machine/the_file";
 
 		if (v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertNull(v.getProtocol());
@@ -1881,11 +1903,11 @@ public class VFSURIValidator {
 		v.assertNull(v.getHostname());
 		v.assertNull(v.getPassword());
 		v.assertNull(v.getPort());
 		v.assertNull(v.getFile());
 
-		s = "https:/ /user:pass:@machine";
+		s = "https:/ /user:pass%3A@machine";
 
 		if (v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertNull(v.getProtocol());
@@ -1893,11 +1915,11 @@ public class VFSURIValidator {
 		v.assertNull(v.getHostname());
 		v.assertNull(v.getPassword());
 		v.assertNull(v.getPort());
 		v.assertNull(v.getFile());
 
-		s = "https://user:pass:@:123/a";
+		s = "https://user:pass%3A@:123/a";
 
 		if (v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertNull(v.getProtocol());
@@ -1905,11 +1927,11 @@ public class VFSURIValidator {
 		v.assertNull(v.getHostname());
 		v.assertNull(v.getPassword());
 		v.assertNull(v.getPort());
 		v.assertNull(v.getFile());
 
-		s = "https://user:pass:@machine:a/the_file";
+		s = "https://user:pass%3A@machine:a/the_file";
 
 		if (v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertNull(v.getProtocol());
@@ -2001,11 +2023,11 @@ public class VFSURIValidator {
 		v.assertNull(v.getHostname());
 		v.assertNull(v.getPassword());
 		v.assertNull(v.getPort());
 		v.assertNull(v.getFile());
 
-		s = "HTTPS://user:pass:@machine/the_file"; //can ":" be part of a password?
+		s = "HTTPS://user:pass%3A@machine/the_file"; //if ":" is part of a password, it must be encoded (: -> %3A)
 
 		if (!v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertEquals(v.getProtocol(), "HTTPS");
@@ -2013,11 +2035,11 @@ public class VFSURIValidator {
 		v.assertEquals(v.getPassword(), "pass:");
 		v.assertEquals(v.getHostname(), "machine");
 		v.assertNull(v.getPort());
 		v.assertEquals(v.getFile(), "/the_file");
 
-		s = "HTTPS://user:pass:@machine/the_dir/";
+		s = "HTTPS://user:pass%3A@machine/the_dir/";
 
 		if (!v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertEquals(v.getProtocol(), "HTTPS");
@@ -2025,11 +2047,11 @@ public class VFSURIValidator {
 		v.assertEquals(v.getPassword(), "pass:");
 		v.assertEquals(v.getHostname(), "machine");
 		v.assertNull(v.getPort());
 		v.assertEquals(v.getFile(), "/the_dir/");
 
-		s = "HTTPS: //user:pass:@machine/the_file"; //failure tests
+		s = "HTTPS: //user:pass%3A@machine/the_file"; //failure tests
 
 		if (v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertNull(v.getProtocol());
@@ -2037,11 +2059,11 @@ public class VFSURIValidator {
 		v.assertNull(v.getHostname());
 		v.assertNull(v.getPassword());
 		v.assertNull(v.getPort());
 		v.assertNull(v.getFile());
 
-		s = "HTTPS:/ /user:pass:@machine/the_file";
+		s = "HTTPS:/ /user:pass%3A@machine/the_file";
 
 		if (v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertNull(v.getProtocol());
@@ -2049,11 +2071,11 @@ public class VFSURIValidator {
 		v.assertNull(v.getHostname());
 		v.assertNull(v.getPassword());
 		v.assertNull(v.getPort());
 		v.assertNull(v.getFile());
 
-		s = "HTTPS:/ /user:pass:@machine";
+		s = "HTTPS:/ /user:pass%3A@machine";
 
 		if (v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertNull(v.getProtocol());
@@ -2061,11 +2083,11 @@ public class VFSURIValidator {
 		v.assertNull(v.getHostname());
 		v.assertNull(v.getPassword());
 		v.assertNull(v.getPort());
 		v.assertNull(v.getFile());
 
-		s = "HTTPS://user:pass:@:123/a";
+		s = "HTTPS://user:pass%3A@:123/a";
 
 		if (v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertNull(v.getProtocol());
@@ -2073,11 +2095,11 @@ public class VFSURIValidator {
 		v.assertNull(v.getHostname());
 		v.assertNull(v.getPassword());
 		v.assertNull(v.getPort());
 		v.assertNull(v.getFile());
 
-		s = "HTTPS://user:pass:@machine:a/the_file";
+		s = "HTTPS://user:pass%3A@machine:a/the_file";
 
 		if (v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertNull(v.getProtocol());
@@ -2170,11 +2192,11 @@ public class VFSURIValidator {
 		v.assertNull(v.getHostname());
 		v.assertNull(v.getPassword());
 		v.assertNull(v.getPort());
 		v.assertNull(v.getFile());
 
-		s = "webdav://user:pass:@machine/the_file"; //can ":" be part of a password?
+		s = "webdav://user:pass%3A@machine/the_file"; //if ":" is part of a password, it must be encoded (: -> %3A)
 
 		if (!v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertEquals(v.getProtocol(), "webdav");
@@ -2182,17 +2204,17 @@ public class VFSURIValidator {
 		v.assertEquals(v.getPassword(), "pass:");
 		v.assertEquals(v.getHostname(), "machine");
 		v.assertNull(v.getPort());
 		v.assertEquals(v.getFile(), "/the_file");
 
-		s = "webdav://user:pass:@machine/the_dir/";
+		s = "webdav://user:pass%3A@machine/the_dir/";
 
 		if (!v.isValid(s)) {
 			v.error_msg(s);
 		}
 
-		s = "webdav: //user:pass:@machine/the_file"; //failure tests
+		s = "webdav: //user:pass%3A@machine/the_file"; //failure tests
 
 		if (v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertNull(v.getProtocol());
@@ -2200,11 +2222,11 @@ public class VFSURIValidator {
 		v.assertNull(v.getHostname());
 		v.assertNull(v.getPassword());
 		v.assertNull(v.getPort());
 		v.assertNull(v.getFile());
 
-		s = "webdav:/ /user:pass:@machine/the_file";
+		s = "webdav:/ /user:pass%3A@machine/the_file";
 
 		if (v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertNull(v.getProtocol());
@@ -2212,11 +2234,11 @@ public class VFSURIValidator {
 		v.assertNull(v.getHostname());
 		v.assertNull(v.getPassword());
 		v.assertNull(v.getPort());
 		v.assertNull(v.getFile());
 
-		s = "webdav:/ /user:pass:@machine";
+		s = "webdav:/ /user:pass%3A@machine";
 
 		if (v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertNull(v.getProtocol());
@@ -2224,11 +2246,11 @@ public class VFSURIValidator {
 		v.assertNull(v.getHostname());
 		v.assertNull(v.getPassword());
 		v.assertNull(v.getPort());
 		v.assertNull(v.getFile());
 
-		s = "webdav://user:pass:@:123/a";
+		s = "webdav://user:pass%3A@:123/a";
 
 		if (v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertNull(v.getProtocol());
@@ -2236,11 +2258,11 @@ public class VFSURIValidator {
 		v.assertNull(v.getHostname());
 		v.assertNull(v.getPassword());
 		v.assertNull(v.getPort());
 		v.assertNull(v.getFile());
 
-		s = "webdav://user:pass:@machine:a/the_file";
+		s = "webdav://user:pass%3A@machine:a/the_file";
 
 		if (v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertNull(v.getProtocol());
@@ -2332,11 +2354,11 @@ public class VFSURIValidator {
 		v.assertNull(v.getHostname());
 		v.assertNull(v.getPassword());
 		v.assertNull(v.getPort());
 		v.assertNull(v.getFile());
 
-		s = "WEBDAV://user:pass:@machine/the_file"; //can ":" be part of a password?
+		s = "WEBDAV://user:pass%3A@machine/the_file"; //if ":" is part of a password, it must be encoded (: -> %3A)
 
 		if (!v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertEquals(v.getProtocol(), "WEBDAV");
@@ -2344,11 +2366,11 @@ public class VFSURIValidator {
 		v.assertEquals(v.getPassword(), "pass:");
 		v.assertEquals(v.getHostname(), "machine");
 		v.assertNull(v.getPort());
 		v.assertEquals(v.getFile(), "/the_file");
 
-		s = "WEBDAV://user:pass:@machine/the_dir/";
+		s = "WEBDAV://user:pass%3A@machine/the_dir/";
 
 		if (!v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertEquals(v.getProtocol(), "WEBDAV");
@@ -2356,11 +2378,11 @@ public class VFSURIValidator {
 		v.assertEquals(v.getPassword(), "pass:");
 		v.assertEquals(v.getHostname(), "machine");
 		v.assertNull(v.getPort());
 		v.assertEquals(v.getFile(), "/the_dir/");
 
-		s = "WEBDAV: //user:pass:@machine/the_file"; //failure tests
+		s = "WEBDAV: //user:pass%3A@machine/the_file"; //failure tests
 
 		if (v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertNull(v.getProtocol());
@@ -2368,11 +2390,11 @@ public class VFSURIValidator {
 		v.assertNull(v.getHostname());
 		v.assertNull(v.getPassword());
 		v.assertNull(v.getPort());
 		v.assertNull(v.getFile());
 
-		s = "WEBDAV:/ /user:pass:@machine/the_file";
+		s = "WEBDAV:/ /user:pass%3A@machine/the_file";
 
 		if (v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertNull(v.getProtocol());
@@ -2380,11 +2402,11 @@ public class VFSURIValidator {
 		v.assertNull(v.getHostname());
 		v.assertNull(v.getPassword());
 		v.assertNull(v.getPort());
 		v.assertNull(v.getFile());
 
-		s = "WEBDAV:/ /user:pass:@machine";
+		s = "WEBDAV:/ /user:pass%3A@machine";
 
 		if (v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertNull(v.getProtocol());
@@ -2392,11 +2414,11 @@ public class VFSURIValidator {
 		v.assertNull(v.getHostname());
 		v.assertNull(v.getPassword());
 		v.assertNull(v.getPort());
 		v.assertNull(v.getFile());
 
-		s = "WEBDAV://user:pass:@:123/a";
+		s = "WEBDAV://user:pass%3A@:123/a";
 
 		if (v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertNull(v.getProtocol());
@@ -2404,11 +2426,11 @@ public class VFSURIValidator {
 		v.assertNull(v.getHostname());
 		v.assertNull(v.getPassword());
 		v.assertNull(v.getPort());
 		v.assertNull(v.getFile());
 
-		s = "WEBDAV://user:pass:@machine:a/the_file";
+		s = "WEBDAV://user:pass%3A@machine:a/the_file";
 
 		if (v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertNull(v.getProtocol());
@@ -2501,11 +2523,11 @@ public class VFSURIValidator {
 		v.assertNull(v.getHostname());
 		v.assertNull(v.getPassword());
 		v.assertNull(v.getPort());
 		v.assertNull(v.getFile());
 
-		s = "smb://user:pass:@machine/the_file"; //can ":" be part of a password?
+		s = "smb://user:pass%3A@machine/the_file"; //if ":" is part of a password, it must be encoded (: -> %3A)
 
 		if (!v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertEquals(v.getProtocol(), "smb");
@@ -2513,11 +2535,11 @@ public class VFSURIValidator {
 		v.assertEquals(v.getPassword(), "pass:");
 		v.assertEquals(v.getHostname(), "machine");
 		v.assertNull(v.getPort());
 		v.assertEquals(v.getFile(), "/the_file");
 
-		s = "smb://user:pass:@machine/the_dir/";
+		s = "smb://user:pass%3A@machine/the_dir/";
 
 		if (!v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertEquals(v.getProtocol(), "smb");
@@ -2525,11 +2547,11 @@ public class VFSURIValidator {
 		v.assertEquals(v.getPassword(), "pass:");
 		v.assertEquals(v.getHostname(), "machine");
 		v.assertNull(v.getPort());
 		v.assertEquals(v.getFile(), "/the_dir/");
 
-		s = "smb: //user:pass:@machine/the_file"; //failure tests
+		s = "smb: //user:pass%3A@machine/the_file"; //failure tests
 
 		if (v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertNull(v.getProtocol());
@@ -2537,11 +2559,11 @@ public class VFSURIValidator {
 		v.assertNull(v.getHostname());
 		v.assertNull(v.getPassword());
 		v.assertNull(v.getPort());
 		v.assertNull(v.getFile());
 
-		s = "smb:/ /user:pass:@machine/the_file";
+		s = "smb:/ /user:pass%3A@machine/the_file";
 
 		if (v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertNull(v.getProtocol());
@@ -2549,11 +2571,11 @@ public class VFSURIValidator {
 		v.assertNull(v.getHostname());
 		v.assertNull(v.getPassword());
 		v.assertNull(v.getPort());
 		v.assertNull(v.getFile());
 
-		s = "smb:/ /user:pass:@machine";
+		s = "smb:/ /user:pass%3A@machine";
 
 		if (v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertNull(v.getProtocol());
@@ -2561,11 +2583,11 @@ public class VFSURIValidator {
 		v.assertNull(v.getHostname());
 		v.assertNull(v.getPassword());
 		v.assertNull(v.getPort());
 		v.assertNull(v.getFile());
 
-		s = "smb://user:pass:@:123/a";
+		s = "smb://user:pass%3A@:123/a";
 
 		if (v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertNull(v.getProtocol());
@@ -2573,11 +2595,11 @@ public class VFSURIValidator {
 		v.assertNull(v.getHostname());
 		v.assertNull(v.getPassword());
 		v.assertNull(v.getPort());
 		v.assertNull(v.getFile());
 
-		s = "smb://user:pass:@machine:a/the_file";
+		s = "smb://user:pass%3A@machine:a/the_file";
 
 		if (v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertNull(v.getProtocol());
@@ -2669,11 +2691,11 @@ public class VFSURIValidator {
 		v.assertNull(v.getHostname());
 		v.assertNull(v.getPassword());
 		v.assertNull(v.getPort());
 		v.assertNull(v.getFile());
 
-		s = "SMB://user:pass:@machine/the_file"; //can ":" be part of a password?
+		s = "SMB://user:pass%3A@machine/the_file"; //if ":" is part of a password, it must be encoded (: -> %3A)
 
 		if (!v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertEquals(v.getProtocol(), "SMB");
@@ -2681,11 +2703,11 @@ public class VFSURIValidator {
 		v.assertEquals(v.getPassword(), "pass:");
 		v.assertEquals(v.getHostname(), "machine");
 		v.assertNull(v.getPort());
 		v.assertEquals(v.getFile(), "/the_file");
 
-		s = "SMB://user:pass:@machine/the_dir/";
+		s = "SMB://user:pass%3A@machine/the_dir/";
 
 		if (!v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertEquals(v.getProtocol(), "SMB");
@@ -2693,11 +2715,11 @@ public class VFSURIValidator {
 		v.assertEquals(v.getPassword(), "pass:");
 		v.assertEquals(v.getHostname(), "machine");
 		v.assertNull(v.getPort());
 		v.assertEquals(v.getFile(), "/the_dir/");
 
-		s = "SMB: //user:pass:@machine/the_file"; //failure tests
+		s = "SMB: //user:pass%3A@machine/the_file"; //failure tests
 
 		if (v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertNull(v.getProtocol());
@@ -2705,11 +2727,11 @@ public class VFSURIValidator {
 		v.assertNull(v.getHostname());
 		v.assertNull(v.getPassword());
 		v.assertNull(v.getPort());
 		v.assertNull(v.getFile());
 
-		s = "SMB:/ /user:pass:@machine/the_file";
+		s = "SMB:/ /user:pass%3A@machine/the_file";
 
 		if (v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertNull(v.getProtocol());
@@ -2717,11 +2739,11 @@ public class VFSURIValidator {
 		v.assertNull(v.getHostname());
 		v.assertNull(v.getPassword());
 		v.assertNull(v.getPort());
 		v.assertNull(v.getFile());
 
-		s = "SMB:/ /user:pass:@machine";
+		s = "SMB:/ /user:pass%3A@machine";
 
 		if (v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertNull(v.getProtocol());
@@ -2729,11 +2751,11 @@ public class VFSURIValidator {
 		v.assertNull(v.getHostname());
 		v.assertNull(v.getPassword());
 		v.assertNull(v.getPort());
 		v.assertNull(v.getFile());
 
-		s = "SMB://user:pass:@:123/a";
+		s = "SMB://user:pass%3A@:123/a";
 
 		if (v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertNull(v.getProtocol());
@@ -2741,11 +2763,11 @@ public class VFSURIValidator {
 		v.assertNull(v.getHostname());
 		v.assertNull(v.getPassword());
 		v.assertNull(v.getPort());
 		v.assertNull(v.getFile());
 
-		s = "SMB://user:pass:@machine:a/the_file";
+		s = "SMB://user:pass%3A@machine:a/the_file";
 
 		if (v.isValid(s)) {
 			v.error_msg(s);
 		}
 		v.assertNull(v.getProtocol());

Vulnerable code: 				.compile("(ftp|FTP|sftp|SFTP|http|HTTP|https|HTTPS|webdav|WEBDAV|smb|SMB)://(.+:.+@)*([^:]+?/*)([ 	]*:[0-9]+)*([ 	]*:)*(/.*)");
				.compile("(ftp|FTP|sftp|SFTP|http|HTTP|https|HTTPS|webdav|WEBDAV|smb|SMB)://(.+:.+@)*([^:]+)([ 	]*:[0-9]+)*([ 	]*:)*(/*?.*)");
		s = "ftp://user:pass:@machine/the_file"; //can ":" be part of a password?
		v.assertEquals(v.getPassword(), "pass:");
		s = "ftp://user:pass:@machine/the_dir/";
		v.assertEquals(v.getPassword(), "pass:");
		s = "FTP://user:pass:@machine/the_file"; //can ":" be part of a password?
		s = "FTP://user:pass:@machine/the_dir/";
		s = "sftp://user:pass:@machine/the_file"; //can ":" be part of a password?
		s = "sftp://user:pass:@machine/the_dir/";
		s = "sftp: //user:pass:@machine/the_file"; //failure tests
		s = "sftp:/ /user:pass:@machine/the_file";
		s = "sftp:/ /user:pass:@machine";
		s = "sftp://user:pass:@:123/a";
		s = "sftp://user:pass:@machine:a/the_file";
		s = "SFTP://user:pass:@machine/the_file"; //can ":" be part of a password?
		s = "SFTP://user:pass:@machine/the_dir/";
		s = "http://user:pass:@machine/the_file"; //can ":" be part of a password?
		s = "http://user:pass:@machine/the_dir/";
		s = "http: //user:pass:@machine/the_file"; //failure tests
		s = "http:/ /user:pass:@machine/the_file";
		s = "http:/ /user:pass:@machine";
		s = "http://user:pass:@:123/a";
		s = "http://user:pass:@machine:a/the_file";
		s = "HTTP://user:pass:@machine/the_file"; //can ":" be part of a password?
		s = "HTTP://user:pass:@machine/the_dir/";
		s = "HTTP: //user:pass:@machine/the_file"; //failure tests
		s = "HTTP:/ /user:pass:@machine/the_file";
		s = "HTTP:/ /user:pass:@machine";
		s = "HTTP://user:pass:@:123/a";
		s = "HTTP://user:pass:@machine:a/the_file";
		s = "https://user:pass:@machine/the_file"; //can ":" be part of a password?
		s = "https://user:pass:@machine/the_dir/";
		s = "https: //user:pass:@machine/the_file"; //failure tests
		s = "https:/ /user:pass:@machine/the_file";
		s = "https:/ /user:pass:@machine";
		s = "https://user:pass:@:123/a";
		s = "https://user:pass:@machine:a/the_file";
		s = "HTTPS://user:pass:@machine/the_file"; //can ":" be part of a password?
		s = "HTTPS://user:pass:@machine/the_dir/";
		s = "HTTPS: //user:pass:@machine/the_file"; //failure tests
		s = "HTTPS:/ /user:pass:@machine/the_file";
		s = "HTTPS:/ /user:pass:@machine";
		s = "HTTPS://user:pass:@:123/a";
		s = "HTTPS://user:pass:@machine:a/the_file";
		s = "webdav://user:pass:@machine/the_file"; //can ":" be part of a password?
		s = "webdav://user:pass:@machine/the_dir/";
		s = "webdav: //user:pass:@machine/the_file"; //failure tests
		s = "webdav:/ /user:pass:@machine/the_file";
		s = "webdav:/ /user:pass:@machine";
		s = "webdav://user:pass:@:123/a";
		s = "webdav://user:pass:@machine:a/the_file";
		s = "WEBDAV://user:pass:@machine/the_file"; //can ":" be part of a password?
		s = "WEBDAV://user:pass:@machine/the_dir/";
		s = "WEBDAV: //user:pass:@machine/the_file"; //failure tests
		s = "WEBDAV:/ /user:pass:@machine/the_file";
		s = "WEBDAV:/ /user:pass:@machine";
		s = "WEBDAV://user:pass:@:123/a";
		s = "WEBDAV://user:pass:@machine:a/the_file";
		s = "smb://user:pass:@machine/the_file"; //can ":" be part of a password?
		s = "smb://user:pass:@machine/the_dir/";
		s = "smb: //user:pass:@machine/the_file"; //failure tests
		s = "smb:/ /user:pass:@machine/the_file";
		s = "smb:/ /user:pass:@machine";
		s = "smb://user:pass:@:123/a";
		s = "smb://user:pass:@machine:a/the_file";
		s = "SMB://user:pass:@machine/the_file"; //can ":" be part of a password?
		s = "SMB://user:pass:@machine/the_dir/";
		s = "SMB: //user:pass:@machine/the_file"; //failure tests
		s = "SMB:/ /user:pass:@machine/the_file";
		s = "SMB:/ /user:pass:@machine";
		s = "SMB://user:pass:@:123/a";
		s = "SMB://user:pass:@machine:a/the_file";
Fixed code:  * Copyright (C) 2020 University of Waikato, Hamilton, NZ
 * Copyright (C) 2020 Yeting Li
				.compile("(ftp|FTP|sftp|SFTP|http|HTTP|https|HTTPS|webdav|WEBDAV|smb|SMB)://([^:@]+:[^:@]+@)*([^:]+?/*)([ ]*:[0-9]+)*([ ]*:)*(/.*)");
				.compile("(ftp|FTP|sftp|SFTP|http|HTTP|https|HTTPS|webdav|WEBDAV|smb|SMB)://([^:@]+:[^:@]+@)*([^:]+)([ 	]*:[0-9]+)*([ 	]*:)*(/*?.*)");
			// decode specials chars (URL encoded %XY)
			if (local_pass.contains("%")) {
				String tmp_local_pass = local_pass;
				StringBuilder new_local_pass = new StringBuilder();
				while (tmp_local_pass.contains("%")) {
					new_local_pass.append(tmp_local_pass.substring(0, tmp_local_pass.indexOf('%')));
					tmp_local_pass = tmp_local_pass.substring(tmp_local_pass.indexOf('%'));
					if (tmp_local_pass.length() >= 3) {
						char c = (char) Integer.parseInt(tmp_local_pass.substring(1, 3), 16);
						new_local_pass.append(c);
						tmp_local_pass = tmp_local_pass.substring(3);
					}
					else {
						break;
					}
				}
				if (!tmp_local_pass.isEmpty())
					new_local_pass.append(tmp_local_pass);
				local_pass = new_local_pass.toString();
			}
		s = "ftp://user:pass%3Aa@machine/the_file"; //if ":" is part of a password, it must be encoded (: -> %3A)
		v.assertEquals(v.getPassword(), "pass:a");
		s = "ftp://user:pass%3A%3a@machine/the_dir/";
		v.assertEquals(v.getPassword(), "pass::");
		s = "FTP://user:pass%3A@machine/the_file"; //if ":" is part of a password, it must be encoded (: -> %3A)
		s = "FTP://user:pass%3A@machine/the_dir/";
		s = "sftp://user:pass%3A@machine/the_file"; //if ":" is part of a password, it must be encoded (: -> %3A)
		s = "sftp://user:pass%3A@machine/the_dir/";
		s = "sftp: //user:pass%3A@machine/the_file"; //failure tests
		s = "sftp:/ /user:pass%3A@machine/the_file";
		s = "sftp:/ /user:pass%3A@machine";
		s = "sftp://user:pass%3A@:123/a";
		s = "sftp://user:pass%3A@machine:a/the_file";
		s = "SFTP://user:pass%3A@machine/the_file"; //if ":" is part of a password, it must be encoded (: -> %3A)
		s = "SFTP://user:pass%3A@machine/the_dir/";
		s = "http://user:pass%3A@machine/the_file"; //if ":" is part of a password, it must be encoded (: -> %3A)
		s = "http://user:pass%3A@machine/the_dir/";
		s = "http: //user:pass%3A@machine/the_file"; //failure tests
		s = "http:/ /user:pass%3A@machine/the_file";
		s = "http:/ /user:pass%3A@machine";
		s = "http://user:pass%3A@:123/a";
		s = "http://user:pass%3A@machine:a/the_file";
		s = "HTTP://user:pass%3A@machine/the_file"; //if ":" is part of a password, it must be encoded (: -> %3A)
		s = "HTTP://user:pass%3A@machine/the_dir/";
		s = "HTTP: //user:pass%3A@machine/the_file"; //failure tests
		s = "HTTP:/ /user:pass%3A@machine/the_file";
		s = "HTTP:/ /user:pass%3A@machine";
		s = "HTTP://user:pass%3A@:123/a";
		s = "HTTP://user:pass%3A@machine:a/the_file";
		s = "https://user:pass%3A@machine/the_file"; //if ":" is part of a password, it must be encoded (: -> %3A)
		s = "https://user:pass%3A@machine/the_dir/";
		s = "https: //user:pass%3A@machine/the_file"; //failure tests
		s = "https:/ /user:pass%3A@machine/the_file";
		s = "https:/ /user:pass%3A@machine";
		s = "https://user:pass%3A@:123/a";
		s = "https://user:pass%3A@machine:a/the_file";
		s = "HTTPS://user:pass%3A@machine/the_file"; //if ":" is part of a password, it must be encoded (: -> %3A)
		s = "HTTPS://user:pass%3A@machine/the_dir/";
		s = "HTTPS: //user:pass%3A@machine/the_file"; //failure tests
		s = "HTTPS:/ /user:pass%3A@machine/the_file";
		s = "HTTPS:/ /user:pass%3A@machine";
		s = "HTTPS://user:pass%3A@:123/a";
		s = "HTTPS://user:pass%3A@machine:a/the_file";
		s = "webdav://user:pass%3A@machine/the_file"; //if ":" is part of a password, it must be encoded (: -> %3A)
		s = "webdav://user:pass%3A@machine/the_dir/";
		s = "webdav: //user:pass%3A@machine/the_file"; //failure tests
		s = "webdav:/ /user:pass%3A@machine/the_file";
		s = "webdav:/ /user:pass%3A@machine";
		s = "webdav://user:pass%3A@:123/a";
		s = "webdav://user:pass%3A@machine:a/the_file";
		s = "WEBDAV://user:pass%3A@machine/the_file"; //if ":" is part of a password, it must be encoded (: -> %3A)
		s = "WEBDAV://user:pass%3A@machine/the_dir/";
		s = "WEBDAV: //user:pass%3A@machine/the_file"; //failure tests
		s = "WEBDAV:/ /user:pass%3A@machine/the_file";
		s = "WEBDAV:/ /user:pass%3A@machine";
		s = "WEBDAV://user:pass%3A@:123/a";
		s = "WEBDAV://user:pass%3A@machine:a/the_file";
		s = "smb://user:pass%3A@machine/the_file"; //if ":" is part of a password, it must be encoded (: -> %3A)
		s = "smb://user:pass%3A@machine/the_dir/";
		s = "smb: //user:pass%3A@machine/the_file"; //failure tests
		s = "smb:/ /user:pass%3A@machine/the_file";
		s = "smb:/ /user:pass%3A@machine";
		s = "smb://user:pass%3A@:123/a";
		s = "smb://user:pass%3A@machine:a/the_file";
		s = "SMB://user:pass%3A@machine/the_file"; //if ":" is part of a password, it must be encoded (: -> %3A)
		s = "SMB://user:pass%3A@machine/the_dir/";
		s = "SMB: //user:pass%3A@machine/the_file"; //failure tests
		s = "SMB:/ /user:pass%3A@machine/the_file";
		s = "SMB:/ /user:pass%3A@machine";
		s = "SMB://user:pass%3A@:123/a";
		s = "SMB://user:pass%3A@machine:a/the_file";