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

Function curl_version

be/src/util/webserver-test.cc:457–478  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

455}
456
457void curl_version(string* curl_output, bool* curl_7_64_or_above = nullptr) {
458 // TODO(todd) IMPALA-8987: import curl into native-toolchain and test this with
459 // authentication.
460 RunShellProcess("curl --version", curl_output);
461
462 // Detect curl version. We only care about the major and minor.
463 std::regex curl_version_regex = std::regex("curl ([0-9]+)\\.([0-9]+)\\.[0-9]+");
464 std::smatch match_result;
465 ASSERT_TRUE(std::regex_search(*curl_output, match_result, curl_version_regex));
466 ASSERT_EQ(match_result.size(), 3);
467
468 int curl_major_version = std::stoi(match_result[1]);
469 int curl_minor_version = std::stoi(match_result[2]);
470 if (curl_7_64_or_above) {
471 *curl_7_64_or_above = curl_major_version > 7 ||
472 (curl_major_version == 7 && curl_minor_version >= 64);
473 }
474 cout << "Detected curl version " << std::to_string(curl_major_version) << "."
475 << std::to_string(curl_minor_version)
476 << (curl_7_64_or_above == nullptr ? " " :
477 (*curl_7_64_or_above ? " is at least 7.64" : " is below 7.64")) << endl;
478}
479
480string curl(const string& curl_options, int32_t port = FLAGS_webserver_port) {
481 string cmd = Substitute("curl -v -f $0 'http://127.0.0.1:$1'", curl_options, port);

Callers 1

TESTFunction · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected