cmCTestCurl.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 "cmStandardIncludes.h"
  13. #include "cm_curl.h"
  14. class cmCTest;
  15. class cmCTestCurl
  16. {
  17. public:
  18. cmCTestCurl(cmCTest*);
  19. ~cmCTestCurl();
  20. bool UploadFile(std::string const& url,
  21. std::string const& file,
  22. std::string const& fields,
  23. std::string& response);
  24. bool HttpRequest(std::string const& url,
  25. std::string const& fields,
  26. std::string& response);
  27. // currently only supports CURLOPT_SSL_VERIFYPEER_OFF
  28. // and CURLOPT_SSL_VERIFYHOST_OFF
  29. void SetCurlOptions(std::vector<std::string> const& args);
  30. void SetUseHttp10On() { this->UseHttp10 = true;}
  31. void SetTimeOutSeconds(int s) { this->TimeOutSeconds = s;}
  32. std::string Escape(std::string const& source);
  33. protected:
  34. void SetProxyType();
  35. bool InitCurl();
  36. private:
  37. cmCTest* CTest;
  38. CURL* Curl;
  39. std::string HTTPProxyAuth;
  40. std::string HTTPProxy;
  41. curl_proxytype HTTPProxyType;
  42. bool VerifyHostOff;
  43. bool VerifyPeerOff;
  44. bool UseHttp10;
  45. int TimeOutSeconds;
  46. };
  47. #endif