* Bug #12761 fixed - The https:// protocol was not supported on ATOMS. 38/12138/2
Clément DAVID [Thu, 25 Jul 2013 16:53:46 +0000 (18:53 +0200)]
Change-Id: I621f293f9e8626c66ce370767bb6971bdaa78795

scilab/CHANGES_5.5.X
scilab/modules/atoms/macros/atomsRepositoryAdd.sci
scilab/modules/atoms/macros/atomsRepositoryList.sci
scilab/modules/atoms/macros/atoms_internals/atomsDESCRIPTIONread.sci
scilab/modules/atoms/macros/atoms_internals/atomsDownload.sci

index 5d0bfd3..f6de4d5 100644 (file)
@@ -436,6 +436,8 @@ Bug fixes
 
 * Bug #12475 fixed - csvRead() does not support double quoted fields.
 
+* Bug #12761 fixed - The https:// protocol was not supported on ATOMS.
+
 * Bug #12490 fixed - plot did not have a clf(); in its demo.
 
 * Bug #12506 fixed - In SciNotes, miscolorization when returned values list was broken.
index f762a17..22d338b 100644 (file)
@@ -28,7 +28,36 @@ function nbAdd = atomsRepositoryAdd(url,section)
     repositories         = []; // Column vector that contains user repositories
     currentRepositories  = atomsRepositoryList();
     currentRepositories  = currentRepositories(:,1);
-    valid_url_pattern    = "/^((((H|h)(T|t)|(F|f))(T|t)(P|p)((S|s)?))\:\/\/)([a-zA-Z0-9]+)([\.][a-zA-Z0-9\-]+)*(\:[0-9]{1,5})*(\/($|[a-zA-Z0-9\.\,\;\?\''\\\+&%\$#\=~_\-]+))*$/";
+    // from https://gist.github.com/dperini/729294
+    // with unicode support, private and local address removed
+    valid_url_pattern    = "/^" +..
+    ..// protocol identifier
+    "(?:(?:https?|ftp):\/\/)" +..
+    ..// user:pass authentication
+    "(?:\S+(?::\S*)?@)?" +..
+    "(?:" +..
+    ..// IP address dotted notation octets
+    ..// excludes loopback network 0.0.0.0
+    ..// excludes reserved space >= 224.0.0.0
+    ..// excludes network & broacast addresses
+    ..// (first & last IP address of each class)
+    "(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])" +..
+    "(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}" +..
+    "(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))" +..
+    "|" +..
+    ..// host name
+    "(?:(?:[a-z0-9]+-?)*[a-z0-9]+)" +..
+    ..// domain name
+    "(?:\.(?:[a-z0-9]+-?)*[a-z0-9]+)*" +..
+    ..// TLD identifier
+    "(?:\.(?:[a-z]{2,}))" +..
+    ")" +..
+    ..// port number
+    "(?::\d{2,5})?" +..
+    ..// resource path
+    "(?:\/[^\s]*)?" +..
+    "$/i";
+
 
     // Check number of input arguments
     // =========================================================================
index 14da826..1f405f3 100644 (file)
@@ -108,7 +108,7 @@ function repositories = atomsRepositoryList(section)
         repositories    = [];
 
         for i=1:size(repositories_in(:,1),"*")
-            if regexp(repositories_in(i,1),"/^(http|ftp):\/\//","o") <> 1 then
+            if regexp(repositories_in(i,1),"/^(https?|ftp):\/\//","o") <> 1 then
                 repositories = [ repositories ; repositories_in(i,:) ];
             end
         end
index a0ad1e5..ea18eb1 100644 (file)
@@ -223,7 +223,7 @@ function description_out = atomsDESCRIPTIONread(file_in,additional)
             // process URLs
             if isfield(additional,"repository") & ..
                 ( regexp(current_field,"/^(source|binary|windows|linux|macosx|solaris|bsd)(32|64)?Url$/","o")<>[] | current_field=="URL" ) & ..
-                regexp(current_value,"/^(http(s)?|ftp(s)?|file)\:\/\//","o")==[] then
+                regexp(current_value,"/^(https?|ftps?|file):\/\//","o")==[] then
                 current_value = additional("repository") + current_value;
             end
 
index 46be4dc..8df14a4 100644 (file)
@@ -56,8 +56,8 @@ function atomsDownload(url_in,file_out,md5sum)
     // Check input parameters value
     // =========================================================================
 
-    if regexp(url_in,"/^(http|ftp|file):\/\//","o") <> 1 then
-        error(msprintf(gettext("%s: Wrong value for input argument #%d: String that start with ''http://'',''ftp://'' or ''file://'' expected.\n"),"atomsDownload",1));
+    if regexp(url_in,"/^(https?|ftp|file):\/\//","o") <> 1 then
+        error(msprintf(gettext("%s: Wrong value for input argument #%d: String that start with ''http(s)?://'',''ftp://'' or ''file://'' expected.\n"),"atomsDownload",1));
     end
 
     if (rhs>2) & (length(md5sum)<>32) then
@@ -107,7 +107,7 @@ function atomsDownload(url_in,file_out,md5sum)
     // Build the command
     // =========================================================================
 
-    if regexp(url_in, "/^(http|ftp):\/\//", "o") == 1 then
+    if regexp(url_in, "/^(https?|ftp):\/\//", "o") == 1 then
         proxy_host_arg = "";
         proxy_user_arg = "";
         timeout_arg  = "";