in sdk/src/http/Url.cc [95:138]
void Url::fromString(const std::string & url)
{
clear();
if (url.empty())
return;
std::string str = url;
std::string::size_type pos = 0;
std::string authority, fragment, path, query, scheme;
pos = str.find("://");
if (pos != str.npos) {
scheme = str.substr(0, pos);
str.erase(0, pos + 3);
}
pos = str.find('#');
if (pos != str.npos) {
fragment = str.substr(pos + 1);
str.erase(pos);
}
pos = str.find('?');
if (pos != str.npos) {
query = str.substr(pos + 1);
str.erase(pos);
}
pos = str.find('/');
if (pos != str.npos) {
path = str.substr(pos);
str.erase(pos);
}
else
path = "/";
authority = str;
setScheme(scheme);
setAuthority(authority);
setPath(path);
setQuery(query);
setFragment(fragment);
}