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

Function GetXFFOriginClientAddress

be/src/rpc/authentication-util.cc:219–235  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

217}
218
219Status GetXFFOriginClientAddress(const std::string_view& xff_addresses,
220 std::string& origin) {
221 if (xff_addresses.empty()) {
222 return Status::Expected("Empty XFF header");
223 }
224 const int pos = xff_addresses.find_first_of(',');
225 if (pos == xff_addresses.npos) {
226 origin = xff_addresses;
227 } else {
228 origin = xff_addresses.substr(0, pos);
229 }
230 StripWhiteSpace(&origin);
231 if (origin.empty()) {
232 return Status::Expected("Empty XFF header");
233 }
234 return Status::OK();
235}
236
237Status BasicAuthExtractCredentials(
238 const string& token, string& username, string& password) {

Callers 4

headersDoneMethod · 0.85
TESTFunction · 0.85
SetOriginFunction · 0.85
BeginRequestCallbackMethod · 0.85

Calls 5

OKFunction · 0.85
substrMethod · 0.80
StripWhiteSpaceFunction · 0.50
emptyMethod · 0.45
find_first_ofMethod · 0.45

Tested by 1

TESTFunction · 0.68