MCPcopy Create free account
hub / github.com/Tablecruncher/tablecruncher / parse_query_text

Function parse_query_text

external/httplib.h:4665–4686  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4663}
4664
4665inline void parse_query_text(const char *data, std::size_t size,
4666 Params &params) {
4667 std::set<std::string> cache;
4668 split(data, data + size, '&', [&](const char *b, const char *e) {
4669 std::string kv(b, e);
4670 if (cache.find(kv) != cache.end()) { return; }
4671 cache.insert(std::move(kv));
4672
4673 std::string key;
4674 std::string val;
4675 divide(b, static_cast<std::size_t>(e - b), '=',
4676 [&](const char *lhs_data, std::size_t lhs_size, const char *rhs_data,
4677 std::size_t rhs_size) {
4678 key.assign(lhs_data, lhs_size);
4679 val.assign(rhs_data, rhs_size);
4680 });
4681
4682 if (!key.empty()) {
4683 params.emplace(decode_url(key, true), decode_url(val, true));
4684 }
4685 });
4686}
4687
4688inline void parse_query_text(const std::string &s, Params &params) {
4689 parse_query_text(s.data(), s.size(), params);

Callers 2

parse_request_lineMethod · 0.85
read_contentMethod · 0.85

Calls 8

divideFunction · 0.85
decode_urlFunction · 0.85
findMethod · 0.80
dataMethod · 0.80
splitFunction · 0.70
endMethod · 0.45
insertMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected