cmCTestCurl.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #ifndef cmCTestCurl_h
  4. #define cmCTestCurl_h
  5. #include <cmConfigure.h> // IWYU pragma: keep
  6. #include <cm_curl.h>
  7. #include <string>
  8. #include <vector>
  9. class cmCTest;
  10. class cmCTestCurl
  11. {
  12. public:
  13. cmCTestCurl(cmCTest*);
  14. ~cmCTestCurl();
  15. bool UploadFile(std::string const& url, std::string const& file,
  16. std::string const& fields, std::string& response);
  17. bool HttpRequest(std::string const& url, std::string const& fields,
  18. std::string& response);
  19. // currently only supports CURLOPT_SSL_VERIFYPEER_OFF
  20. // and CURLOPT_SSL_VERIFYHOST_OFF
  21. void SetCurlOptions(std::vector<std::string> const& args);
  22. void SetUseHttp10On() { this->UseHttp10 = true; }
  23. void SetTimeOutSeconds(int s) { this->TimeOutSeconds = s; }
  24. void SetQuiet(bool b) { this->Quiet = b; }
  25. std::string Escape(std::string const& source);
  26. protected:
  27. void SetProxyType();
  28. bool InitCurl();
  29. private:
  30. cmCTest* CTest;
  31. CURL* Curl;
  32. std::string HTTPProxyAuth;
  33. std::string HTTPProxy;
  34. curl_proxytype HTTPProxyType;
  35. bool VerifyHostOff;
  36. bool VerifyPeerOff;
  37. bool UseHttp10;
  38. bool Quiet;
  39. int TimeOutSeconds;
  40. };
  41. #endif