Skip to content

Commit

Permalink
Less restrictive regexp on surls.
Browse files Browse the repository at this point in the history
  • Loading branch information
andreaceccanti committed Dec 17, 2013
1 parent 603f7d3 commit eb1f676
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/frontend/surl_normalizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <boost/regex.hpp>
#include "storm_exception.hpp"

static const std::string SRM_URL_REGEXP = "^srm://[A-Za-z0-9\\.\\-]+(:\\d{1,4})?/+(srm/managerv2\\?SFN=)?[A-Za-z0-9\\._\\-/]*$";
static const std::string SRM_URL_REGEXP = "^srm://[A-Za-z0-9\\.\\-\\[\\]:]+(:\\d{1,4})?/+(srm/managerv2\\?SFN=)?\\S*$";

inline bool srm_url_valid(std::string const& srm_url){
static boost::regex const e(SRM_URL_REGEXP);
Expand Down
16 changes: 10 additions & 6 deletions src/frontend/test_surl.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,25 @@ int main(int argc, const char *argv[])
"srm://host.ciccio:8444/test//palla",
"srm://host.ciccio/manager",
"srm://host.com:8009//srm/managerv2?SFN=/test//ciccio",
"srm://atlasse.lnf.infn.it/dpm/lnf.infn.it/home/atlas/atlasdatadisk/rucio/mc12_8TeV/52/d4/NTUP_TRUTH.01369588._000098.root.1"
"srm://atlasse.lnf.infn.it/dpm/lnf.infn.it/home/atlas/atlasdatadisk/rucio/mc12_8TeV/52/d4/NTUP_TRUTH.01369588._000098.root.1",
"srm://[2001:720:1210:f023::65]:8444/srm/managerv2?SFN=/lhcp/plus+minus-ciccio,also_with_a_comma.txt",
"srm://[2001:720:1210:f023::65]:8444/ciccio+caio_[{}]/horrible.txt"
};

const char* expected[] = {
"srm://host.ciccio:8444/test/palla",
"srm://host.ciccio/manager",
"srm://host.com:8009/test/ciccio",
"srm://atlasse.lnf.infn.it/dpm/lnf.infn.it/home/atlas/atlasdatadisk/rucio/mc12_8TeV/52/d4/NTUP_TRUTH.01369588._000098.root.1"
"srm://host.ciccio:8444/test/palla",
"srm://host.ciccio/manager",
"srm://host.com:8009/test/ciccio",
"srm://atlasse.lnf.infn.it/dpm/lnf.infn.it/home/atlas/atlasdatadisk/rucio/mc12_8TeV/52/d4/NTUP_TRUTH.01369588._000098.root.1",
"srm://[2001:720:1210:f023::65]:8444/lhcp/plus+minus-ciccio,also_with_a_comma.txt",
"srm://[2001:720:1210:f023::65]:8444/ciccio+caio_[{}]/horrible.txt"
};

const char* invalid_surls[] = {
"invalid surl",
"http://www.google.com",
"https://www.cicciopalla.com",
"",
"srm://ciccio.srm.org/file with space",
0
};

Expand Down

0 comments on commit eb1f676

Please sign in to comment.