MCPcopy Create free account
hub / github.com/apache/mesos / foreach

Function foreach

3rdparty/libprocess/src/http.cpp:344–369  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

342 candidates.push_back("*"); // Rule 2.
343
344 foreach (const string& candidate, candidates) {
345 // Is the candidate one of the accepted encodings?
346 foreach (const string& encoding_, strings::tokenize(accept.get(), ",")) {
347 vector<string> tokens = strings::tokenize(encoding_, ";");
348
349 if (tokens.empty()) {
350 continue;
351 }
352
353 if (strings::lower(tokens[0]) == strings::lower(candidate)) {
354 // Is there a 0 q value? Ex: 'gzip;q=0.0'.
355 const map<string, vector<string>> values =
356 strings::pairs(encoding_, ";", "=");
357
358 // Look for { "q": ["0"] }.
359 if (values.count("q") == 0 || values.find("q")->second.size() != 1) {
360 // No q value, or malformed q value.
361 return true;
362 }
363
364 // Is the q value > 0?
365 Try<double> value = numify<double>(values.find("q")->second[0]);
366 return value.isSome() && value.get() > 0;
367 }
368 }
369 }
370
371 return false;
372}

Callers

nothing calls this directly

Calls 15

tokenizeFunction · 0.85
lowerFunction · 0.85
pairsFunction · 0.85
NoneClass · 0.85
splitFunction · 0.85
decodeFunction · 0.70
errorMethod · 0.65
ErrorClass · 0.50
fFunction · 0.50
emptyMethod · 0.45
countMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected