[Cmake-commits] [cmake-commits] zach.mullen committed cmCTest.cxx 1.385 1.386 cmCTest.h 1.130 1.131 cmSystemTools.cxx 1.425 1.426 cmSystemTools.h 1.167 1.168

cmake-commits at cmake.org cmake-commits at cmake.org
Tue Dec 22 14:37:08 EST 2009


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv28887

Modified Files:
	cmCTest.cxx cmCTest.h cmSystemTools.cxx cmSystemTools.h 
Log Message:
Move cURL dependent code out of CMakeLib to fix complex tests.


Index: cmCTest.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmCTest.h,v
retrieving revision 1.130
retrieving revision 1.131
diff -C 2 -d -r1.130 -r1.131
*** cmCTest.h	21 Dec 2009 20:47:29 -0000	1.130
--- cmCTest.h	22 Dec 2009 19:37:06 -0000	1.131
***************
*** 81,84 ****
--- 81,97 ----
      std::string Name;
    };
+ #ifdef CMAKE_BUILD_WITH_CMAKE
+   enum HTTPMethod {
+     HTTP_GET,
+     HTTP_POST
+   };
+ 
+   /**
+    * Perform an HTTP request.
+    */
+   static int HTTPRequest(std::string url, HTTPMethod method,
+                           std::string& response,
+                           std::string fields = "", int timeout = 10);
+ #endif
  
    /** Get a testing part id from its string name.  Returns PartCount

Index: cmSystemTools.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmSystemTools.h,v
retrieving revision 1.167
retrieving revision 1.168
diff -C 2 -d -r1.167 -r1.168
*** cmSystemTools.h	21 Dec 2009 21:42:32 -0000	1.167
--- cmSystemTools.h	22 Dec 2009 19:37:06 -0000	1.168
***************
*** 343,358 ****
  
  #ifdef CMAKE_BUILD_WITH_CMAKE
-   enum HTTPMethod {
-     HTTP_GET,
-     HTTP_POST
-   };
- 
-   /**
-    * Perform an HTTP request.
-    */
-   static int HTTPRequest(std::string url, HTTPMethod method,
-                           std::string& response,
-                           std::string fields = "", int timeout = 10);
- 
    /** Remove an environment variable */
    static bool UnsetEnv(const char* value);
--- 343,346 ----

Index: cmSystemTools.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmSystemTools.cxx,v
retrieving revision 1.425
retrieving revision 1.426
diff -C 2 -d -r1.425 -r1.426
*** cmSystemTools.cxx	22 Dec 2009 14:03:18 -0000	1.425
--- cmSystemTools.cxx	22 Dec 2009 19:37:06 -0000	1.426
***************
*** 27,31 ****
  #include <cmlibarchive/libarchive/archive_entry.h>
  # include <cmsys/Terminal.h>
- #include "cm_curl.h"
  #endif
  #include <cmsys/stl/algorithm>
--- 27,30 ----
***************
*** 2927,2980 ****
  #endif
  }
- 
- //----------------------------------------------------------------------------
- static size_t
- HTTPResponseCallback(void *ptr, size_t size, size_t nmemb, void *data)
- {
-   register int realsize = (int)(size * nmemb);
- 
-   std::string *response
-     = static_cast<std::string*>(data);
-   const char* chPtr = static_cast<char*>(ptr);
-   *response += chPtr;
- 
-   return realsize;
- }
- 
- #ifdef CMAKE_BUILD_WITH_CMAKE
- //----------------------------------------------------------------------------
- int cmSystemTools::HTTPRequest(std::string url, HTTPMethod method,
-                                        std::string& response,
-                                        std::string fields, int timeout)
- {
-   CURL* curl;
-   ::curl_global_init(CURL_GLOBAL_ALL);
-   curl = ::curl_easy_init();
- 
-   //set request options
-   if(method == cmSystemTools::HTTP_GET && fields.size())
-     {
-     url += "?" + fields;
-     }
-   else
-     {
-     ::curl_easy_setopt(curl, CURLOPT_POST, 1);
-     ::curl_easy_setopt(curl, CURLOPT_POSTFIELDS, fields.c_str());
-     }
-   ::curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
-   ::curl_easy_setopt(curl, CURLOPT_TIMEOUT, timeout);
-   ::curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
- 
-   //set response options
-   ::curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, HTTPResponseCallback);
-   ::curl_easy_setopt(curl, CURLOPT_FILE, (void *)&response);
-   ::curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1);
- 
-   CURLcode res = ::curl_easy_perform(curl);
- 
-   ::curl_easy_cleanup(curl);
-   ::curl_global_cleanup();
-   
-   return static_cast<int>(res);
- }
- #endif
--- 2926,2927 ----

Index: cmCTest.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmCTest.cxx,v
retrieving revision 1.385
retrieving revision 1.386
diff -C 2 -d -r1.385 -r1.386
*** cmCTest.cxx	21 Dec 2009 21:42:32 -0000	1.385
--- cmCTest.cxx	22 Dec 2009 19:37:06 -0000	1.386
***************
*** 155,158 ****
--- 155,210 ----
  }
  
+ #ifdef CMAKE_BUILD_WITH_CMAKE
+ //----------------------------------------------------------------------------
+ static size_t
+ HTTPResponseCallback(void *ptr, size_t size, size_t nmemb, void *data)
+ {
+   register int realsize = (int)(size * nmemb);
+ 
+   std::string *response
+     = static_cast<std::string*>(data);
+   const char* chPtr = static_cast<char*>(ptr);
+   *response += chPtr;
+ 
+   return realsize;
+ }
+ 
+ //----------------------------------------------------------------------------
+ int cmCTest::HTTPRequest(std::string url, HTTPMethod method,
+                                        std::string& response,
+                                        std::string fields, int timeout)
+ {
+   CURL* curl;
+   ::curl_global_init(CURL_GLOBAL_ALL);
+   curl = ::curl_easy_init();
+ 
+   //set request options
+   if(method == cmCTest::HTTP_GET && fields.size())
+     {
+     url += "?" + fields;
+     }
+   else
+     {
+     ::curl_easy_setopt(curl, CURLOPT_POST, 1);
+     ::curl_easy_setopt(curl, CURLOPT_POSTFIELDS, fields.c_str());
+     }
+   ::curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
+   ::curl_easy_setopt(curl, CURLOPT_TIMEOUT, timeout);
+   ::curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
+ 
+   //set response options
+   ::curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, HTTPResponseCallback);
+   ::curl_easy_setopt(curl, CURLOPT_FILE, (void *)&response);
+   ::curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1);
+ 
+   CURLcode res = ::curl_easy_perform(curl);
+ 
+   ::curl_easy_cleanup(curl);
+   ::curl_global_cleanup();
+   
+   return static_cast<int>(res);
+ }
+ #endif
+ 
  //----------------------------------------------------------------------
  std::string cmCTest::MakeURLSafe(const std::string& str)
***************
*** 327,331 ****
    url += this->GetCTestConfiguration("DropSite") + "/CDash/api/getversion.php";
    
!   int res = cmSystemTools::HTTPRequest(url, cmSystemTools::HTTP_GET, response);
    
    return res ? this->GetCTestConfiguration("CDashVersion") : response;
--- 379,383 ----
    url += this->GetCTestConfiguration("DropSite") + "/CDash/api/getversion.php";
    
!   int res = cmCTest::HTTPRequest(url, cmCTest::HTTP_GET, response);
    
    return res ? this->GetCTestConfiguration("CDashVersion") : response;



More information about the Cmake-commits mailing list