cmCTestCurl.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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, std::string const& file,
  21. std::string const& fields, std::string& response);
  22. bool HttpRequest(std::string const& url, std::string const& fields,
  23. std::string& response);
  24. // currently only supports CURLOPT_SSL_VERIFYPEER_OFF
  25. // and CURLOPT_SSL_VERIFYHOST_OFF
  26. void SetCurlOptions(std::vector<std::string> const& args);
  27. void SetUseHttp10On() { this->UseHttp10 = true; }
  28. void SetTimeOutSeconds(int s) { this->TimeOutSeconds = s; }
  29. std::string Escape(std::string const& source);
  30. protected:
  31. void SetProxyType();
  32. bool InitCurl();
  33. private:
  34. cmCTest* CTest;
  35. CURL* Curl;
  36. std::string HTTPProxyAuth;
  37. std::string HTTPProxy;
  38. curl_proxytype HTTPProxyType;
  39. bool VerifyHostOff;
  40. bool VerifyPeerOff;
  41. bool UseHttp10;
  42. int TimeOutSeconds;
  43. };
  44. #endif