summaryrefslogtreecommitdiffstats
path: root/Source/cmFileCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-05-28 14:54:39 (GMT)
committerBrad King <brad.king@kitware.com>2015-05-28 15:11:28 (GMT)
commiteba12a43615ee603f7e90a8e4e8c7669e7d63cf8 (patch)
treef88a744d6e100748b89cfed7bc9f7e19536e55c5 /Source/cmFileCommand.cxx
parent7e10f1691f61949430180882e3a2484d0859b9e2 (diff)
downloadCMake-eba12a43615ee603f7e90a8e4e8c7669e7d63cf8.zip
CMake-eba12a43615ee603f7e90a8e4e8c7669e7d63cf8.tar.gz
CMake-eba12a43615ee603f7e90a8e4e8c7669e7d63cf8.tar.bz2
cmFileCommand: Do not log raw protocol data from curl (#15589)
Teach cmFileCommandCurlDebugCallback to filter the debug data by type and show only summary information instead of the raw data. This avoids allocating memory for all data transferred by UPLOAD or DOWNLOAD.
Diffstat (limited to 'Source/cmFileCommand.cxx')
-rw-r--r--Source/cmFileCommand.cxx29
1 files changed, 26 insertions, 3 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 2c2c1c0..4698468 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -2798,13 +2798,36 @@ namespace {
static size_t
- cmFileCommandCurlDebugCallback(CURL *, curl_infotype, char *chPtr,
+ cmFileCommandCurlDebugCallback(CURL *, curl_infotype type, char *chPtr,
size_t size, void *data)
{
cmFileCommandVectorOfChar *vec
= static_cast<cmFileCommandVectorOfChar*>(data);
- vec->insert(vec->end(), chPtr, chPtr + size);
- return size;
+ switch(type)
+ {
+ case CURLINFO_TEXT:
+ case CURLINFO_HEADER_IN:
+ case CURLINFO_HEADER_OUT:
+ vec->insert(vec->end(), chPtr, chPtr + size);
+ break;
+ case CURLINFO_DATA_IN:
+ case CURLINFO_DATA_OUT:
+ case CURLINFO_SSL_DATA_IN:
+ case CURLINFO_SSL_DATA_OUT:
+ {
+ char buf[128];
+ int n = sprintf(buf, "[%" cmIML_INT_PRIu64 " bytes data]\n",
+ static_cast<cmIML_INT_uint64_t>(size));
+ if (n > 0)
+ {
+ vec->insert(vec->end(), buf, buf + n);
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ return 0;
}