MCPcopy Create free account
hub / github.com/apache/impala / ParseParams

Function ParseParams

be/src/rpc/authentication.cc:961–980  ·  view source on GitHub ↗

Parses a param string. params_to_check: map from the name of params that should be parsed to pointers where the value should be written original: the full http path (used only in error message) params_string: & delimited param string to parse err_msg: write detailed message here in case of error

Source from the content-addressed store, hash-verified

959// params_string: & delimited param string to parse
960// err_msg: write detailed message here in case of error
961bool ParseParams(std::map<string, string*>& params_to_check,
962 const string& original, const string& params_string, string* err_msg) {
963 for (auto pair : Split(params_string, "&")) {
964 vector<string> key_value = Split(pair, delimiter::Limit("=", 1));
965 if (key_value.size() == 2) {
966 auto it = params_to_check.find(key_value[0]);
967 if (it == params_to_check.end()) continue;
968 string decoded;
969 if (!UrlDecode(key_value[1], &decoded)) {
970 *err_msg = Substitute(
971 "Could not decode '$0' parameter from HTTP request with path: $1",
972 key_value[0], original);
973 return false;
974 } else {
975 *it->second = decoded;
976 }
977 }
978 }
979 return true;
980}
981
982// Takes the path component of an HTTP request and parses it.
983// The followings are inspected in the path:

Callers 2

HttpPathFnFunction · 0.85

Calls 7

SplitFunction · 0.85
LimitFunction · 0.85
SubstituteFunction · 0.85
UrlDecodeFunction · 0.50
sizeMethod · 0.45
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected