| 4168 | } |
| 4169 | |
| 4170 | inline void parse_query_text(const std::string &s, Params ¶ms) { |
| 4171 | std::set<std::string> cache; |
| 4172 | split(s.data(), s.data() + s.size(), '&', [&](const char *b, const char *e) { |
| 4173 | std::string kv(b, e); |
| 4174 | if (cache.find(kv) != cache.end()) { return; } |
| 4175 | cache.insert(kv); |
| 4176 | |
| 4177 | std::string key; |
| 4178 | std::string val; |
| 4179 | split(b, e, '=', [&](const char *b2, const char *e2) { |
| 4180 | if (key.empty()) { |
| 4181 | key.assign(b2, e2); |
| 4182 | } else { |
| 4183 | val.assign(b2, e2); |
| 4184 | } |
| 4185 | }); |
| 4186 | |
| 4187 | if (!key.empty()) { |
| 4188 | params.emplace(decode_url(key, true), decode_url(val, true)); |
| 4189 | } |
| 4190 | }); |
| 4191 | } |
| 4192 | |
| 4193 | inline bool parse_multipart_boundary(const std::string &content_type, |
| 4194 | std::string &boundary) { |