Open srogatch opened 3 years ago
Hey @srogatch ,
Thanks for the bug report!
As a workaround you may do directly parseQueryParams
like this:
oatpp::String urlStr = "/url?q=https://apps.quanticfoundry.com/recommendations/gamerprofile/videogame/&sa=U&ved=2ahUKEwj_3NHchPfrAhVlk4sKHQNtCHIQFjAAegQIBBAB&usg=AOvVaw2BELlxCNpDwCHqFTwOx_EE";
auto params = oatpp::network::Url::Parser::parseQueryParams(urlStr);
for(auto& p : params.getAll()) {
//oatpp::String name = p.first.toString(); // Do like this if you need
//oatpp::String value = p.second.toString();
OATPP_LOGD("AAA", "name='%s', value='%s'", p.first.getData(), p.second.getData());
}
Output:
D |2020-09-21 00:48:38 1600638518956974| AAA:name='usg', value='AOvVaw2BELlxCNpDwCHqFTwOx_EE'
D |2020-09-21 00:48:38 1600638518957457| AAA:name='ved', value='2ahUKEwj_3NHchPfrAhVlk4sKHQNtCHIQFjAAegQIBBAB'
D |2020-09-21 00:48:38 1600638518957468| AAA:name='sa', value='U'
D |2020-09-21 00:48:38 1600638518957476| AAA:name='q', value='https://apps.quanticfoundry.com/recommendations/gamerprofile/videogame/'
Thanks, @lganzzzo , that works.
Consider the following relative URL and its parsing with
oatpp
:Unfortunately,
/url?q=https://
gets into the scheme part, and so on the parsing gets wrong.