Salome HOME
Allow EDF URL style
authorAnthony Geay <anthony.geay@edf.fr>
Fri, 10 Sep 2021 13:23:36 +0000 (15:23 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Fri, 10 Sep 2021 13:23:36 +0000 (15:23 +0200)
src/SMESHUtils/SMESH_MGLicenseKeyGen.cxx

index e1d2db8d240afc2bca713568023696fce087c0eb..99336c6a34a28e226cae3228ba8be9858bdfaec1 100644 (file)
@@ -197,17 +197,32 @@ namespace
 
   bool isURL( LibraryFile & libraryFile )
   {
-    enum { SCHEME = 2, AUTHORITY = 4, PATH = 5 }; // sub-strings
-    std::regex urlRegex ( R"(^(([^:\/?#]+):)?(//([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?)",
-                          std::regex::extended );
-    std::smatch matchResult;
-
-    libraryFile._isURL = false;
-    if ( std::regex_match( libraryFile._name, matchResult, urlRegex ))
-      libraryFile._isURL = ( !matchResult.str( SCHEME    ).empty() &&
-                             !matchResult.str( AUTHORITY ).empty() &&
-                             !matchResult.str( PATH      ).empty() );
-
+    {// round1
+      enum { SCHEME = 2, AUTHORITY = 4, PATH = 5 }; // sub-strings
+      std::regex urlRegex ( R"(^(([^:\/?#]+):)?(//([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?)",
+                            std::regex::extended );
+      std::smatch matchResult;
+
+      libraryFile._isURL = false;
+      if ( std::regex_match( libraryFile._name, matchResult, urlRegex ))
+        libraryFile._isURL = ( !matchResult.str( SCHEME    ).empty() &&
+                              !matchResult.str( AUTHORITY ).empty() &&
+                              !matchResult.str( PATH      ).empty() );
+    }
+    if(libraryFile._isURL)
+      return true;
+    {// round2
+      enum { HOST = 2, PORT = 3, PATH = 4 }; // sub-strings
+      std::regex urlRegex ( R"(^(([^:\/?#]+):)?([^/]+)?(/[^#]*))",
+                            std::regex::extended );
+      std::smatch matchResult;
+
+      libraryFile._isURL = false;
+      if ( std::regex_match( libraryFile._name, matchResult, urlRegex ))
+        libraryFile._isURL = ( !matchResult.str( HOST ).empty() &&
+                              !matchResult.str( PORT ).empty() &&
+                              !matchResult.str( PATH ).empty() );
+    }
     return libraryFile._isURL;
   }