From bd19f3d3154d885b365ecad903bb9f6b31cb0a4a Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Fri, 10 Sep 2021 15:23:36 +0200 Subject: [PATCH] Allow EDF URL style --- src/SMESHUtils/SMESH_MGLicenseKeyGen.cxx | 37 +++++++++++++++++------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/src/SMESHUtils/SMESH_MGLicenseKeyGen.cxx b/src/SMESHUtils/SMESH_MGLicenseKeyGen.cxx index e1d2db8d2..99336c6a3 100644 --- a/src/SMESHUtils/SMESH_MGLicenseKeyGen.cxx +++ b/src/SMESHUtils/SMESH_MGLicenseKeyGen.cxx @@ -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; } -- 2.39.2