139 {
140 std::vector<std::string> explodedString =
explode(cpath,
'/');
141 std::vector<std::string> explodedReqString =
explode(req.
url,
'/');
142
143 for (std::vector<std::string>::size_type i = 0; i < explodedString.size() && i < explodedReqString.size(); i++) {
144 if (explodedString[i].front() == ':') {
145 const std::smatch smatch =
matchResult(explodedString[i]);
146 std::string regex = "(.*)";
147
148 if (smatch.size() > 1) {
149 if (smatch[1] != "") {
150 regex = smatch[1];
151 }
152 }
153
154 if (std::regex_match(explodedReqString[i], std::regex(regex))) {
155 std::string attributeName = smatch[0];
156 attributeName.erase(0, 1);
157 attributeName.erase((attributeName.length() - static_cast<std::size_t>(smatch[1].length())),
158 static_cast<std::size_t>(smatch[1].length()));
159
160 req.
params[attributeName] = explodedReqString[i];
161 }
162 }
163 }
164 }
std::map< std::string, std::string > params