Skip to content

Commit 0b4dcf4

Browse files
committed
Avoid regex in standardize_url
1 parent 19e3f31 commit 0b4dcf4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/http_utils.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,11 @@ std::vector<std::string> http_utils::tokenize_url(
223223

224224
std::string http_utils::standardize_url(const std::string& url)
225225
{
226-
std::string n_url = string_utilities::regex_replace(url, "(\\/)+", "/");
226+
std::string n_url = url;
227+
228+
std::string::iterator new_end = std::unique(n_url.begin(), n_url.end(), [](char a, char b) { return (a == b) && (a == ' '); });
229+
n_url.erase(new_end, n_url.end());
230+
227231
std::string::size_type n_url_length = n_url.length();
228232

229233
std::string result;

0 commit comments

Comments
 (0)