78 bool matchFunction(
const std::string& cpath,
const std::string& reqpath) {
79 std::vector<std::string> explodedString = explode(cpath,
'/');
81 for (std::vector<std::string>::size_type i = 0; i < explodedString.size(); i++) {
82 if (explodedString[i].front() ==
':') {
83 const std::smatch smatch = matchResult(explodedString[i]);
84 std::string regex =
"(.*)";
86 if (smatch.size() > 1) {
87 if (smatch[1] !=
"") {
92 explodedString[i] = regex;
96 const std::string regexPath = path_concat(explodedString);
98 return std::regex_match(reqpath, std::regex(regexPath));
102 std::vector<std::string> explodedString = explode(cpath,
'/');
103 std::vector<std::string> explodedReqString = explode(req.url,
'/');
105 for (std::vector<std::string>::size_type i = 0; i < explodedString.size() && i < explodedReqString.size(); i++) {
106 if (explodedString[i].front() ==
':') {
107 const std::smatch smatch = matchResult(explodedString[i]);
108 std::string regex =
"(.*)";
110 if (smatch.size() > 1) {
111 if (smatch[1] !=
"") {
116 if (std::regex_match(explodedReqString[i], std::regex(regex))) {
117 std::string attributeName = smatch[0];
118 attributeName.erase(0, 1);
119 attributeName.erase((attributeName.length() -
static_cast<std::size_t>(smatch[1].length())),
120 static_cast<std::size_t>(smatch[1].length()));
122 req.params[attributeName] = explodedReqString[i];