MCPcopy Create free account
hub / github.com/PurpleI2P/i2pd / parse_query

Method parse_query

libi2pd/HTTP.cpp:212–231  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

210 }
211
212 bool URL::parse_query(std::map<std::string, std::string> & params)
213 {
214 std::vector<std::string_view> tokens;
215 strsplit(query, tokens, '&');
216
217 params.clear();
218 for (const auto& it : tokens) {
219 if (!it.length()) // empty
220 continue;
221 std::size_t eq = it.find ('=');
222 if (eq != std::string::npos) {
223 auto e = std::pair<std::string, std::string>(it.substr(0, eq), it.substr(eq + 1));
224 params.insert(e);
225 } else {
226 auto e = std::pair<std::string, std::string>(it, "");
227 params.insert(e);
228 }
229 }
230 return true;
231 }
232
233 std::string URL::to_string() {
234 std::string out = "";

Callers 4

ExtractAddressHelperMethod · 0.80
mainFunction · 0.80
HandlePageMethod · 0.80
HandleCommandMethod · 0.80

Calls 1

strsplitFunction · 0.85

Tested by 1

mainFunction · 0.64