From eb1f67607cca54bc1eb6d89f7d37ad77efb7e4f5 Mon Sep 17 00:00:00 2001 From: Andrea Ceccanti Date: Tue, 17 Dec 2013 17:50:39 +0100 Subject: [PATCH] Less restrictive regexp on surls. --- src/frontend/surl_normalizer.cc | 2 +- src/frontend/test_surl.c | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/frontend/surl_normalizer.cc b/src/frontend/surl_normalizer.cc index febbdb6..36b34e3 100644 --- a/src/frontend/surl_normalizer.cc +++ b/src/frontend/surl_normalizer.cc @@ -2,7 +2,7 @@ #include #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); diff --git a/src/frontend/test_surl.c b/src/frontend/test_surl.c index 0e6a949..334a3f5 100644 --- a/src/frontend/test_surl.c +++ b/src/frontend/test_surl.c @@ -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 };