Open alexey-malov opened 5 years ago
bool ParseURL(const std::string& url, Protocol& protocol, int& port, std::string& host, std::string& document) { std::string regexStr = (boost::format(URL_REGEX_PATTERN) % PROTOCOL_REGEX % HOST_REGEX % PORT_REGEX % PATH_REGEX).str(); std::regex reg(regexStr, std::regex_constants::icase); std::cmatch match; if (std::regex_match(url.c_str(), match, reg))
if (port < MIN_PORT || port > MAX_PORT) { throw std::out_of_range("Port must be in range " + std::to_string(MIN_PORT) + "-" + std::to_string(MAX_PORT) + ", '" + str + "' given"); }