cmCTestCurl.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. std::string Escape(std::string const& source);
  25. protected:
  26. void SetProxyType();
  27. bool InitCurl();
  28. private:
  29. cmCTest* CTest;
  30. CURL* Curl;
  31. std::string HTTPProxyAuth;
  32. std::string HTTPProxy;
  33. curl_proxytype HTTPProxyType;
  34. bool VerifyHostOff;
  35. bool VerifyPeerOff;
  36. bool UseHttp10;
  37. int TimeOutSeconds;
  38. };
  39. #endif