| 5639 | } |
| 5640 | |
| 5641 | inline bool Server::dispatch_request(Request &req, Response &res, |
| 5642 | const Handlers &handlers) { |
| 5643 | for (const auto &x : handlers) { |
| 5644 | const auto &pattern = x.first; |
| 5645 | const auto &handler = x.second; |
| 5646 | |
| 5647 | if (std::regex_match(req.path, req.matches, pattern)) { |
| 5648 | handler(req, res); |
| 5649 | return true; |
| 5650 | } |
| 5651 | } |
| 5652 | return false; |
| 5653 | } |
| 5654 | |
| 5655 | inline void Server::apply_ranges(const Request &req, Response &res, |
| 5656 | std::string &content_type, |