cmCTestCurl.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2000-2015 Kitware, Inc.
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. #ifndef cmCTestCurl_h
  11. #define cmCTestCurl_h
  12. #include <cmConfigure.h> // IWYU pragma: keep
  13. #include <cm_curl.h>
  14. #include <string>
  15. #include <vector>
  16. class cmCTest;
  17. class cmCTestCurl
  18. {
  19. public:
  20. cmCTestCurl(cmCTest*);
  21. ~cmCTestCurl();
  22. bool UploadFile(std::string const& url, std::string const& file,
  23. std::string const& fields, std::string& response);
  24. bool HttpRequest(std::string const& url, std::string const& fields,
  25. std::string& response);
  26. // currently only supports CURLOPT_SSL_VERIFYPEER_OFF
  27. // and CURLOPT_SSL_VERIFYHOST_OFF
  28. void SetCurlOptions(std::vector<std::string> const& args);
  29. void SetUseHttp10On() { this->UseHttp10 = true; }
  30. void SetTimeOutSeconds(int s) { this->TimeOutSeconds = s; }
  31. std::string Escape(std::string const& source);
  32. protected:
  33. void SetProxyType();
  34. bool InitCurl();
  35. private:
  36. cmCTest* CTest;
  37. CURL* Curl;
  38. std::string HTTPProxyAuth;
  39. std::string HTTPProxy;
  40. curl_proxytype HTTPProxyType;
  41. bool VerifyHostOff;
  42. bool VerifyPeerOff;
  43. bool UseHttp10;
  44. int TimeOutSeconds;
  45. };
  46. #endif