summaryrefslogtreecommitdiffstats
path: root/Source/cmCurl.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmCurl.cxx')
-rw-r--r--Source/cmCurl.cxx7
1 files changed, 6 insertions, 1 deletions
diff --git a/Source/cmCurl.cxx b/Source/cmCurl.cxx
index 7a6568e..fa001d2 100644
--- a/Source/cmCurl.cxx
+++ b/Source/cmCurl.cxx
@@ -5,9 +5,9 @@
#if !defined(CMAKE_USE_SYSTEM_CURL) && !defined(_WIN32) && \
!defined(__APPLE__) && !defined(CURL_CA_BUNDLE) && !defined(CURL_CA_PATH)
# define CMAKE_FIND_CAFILE
-# include "cmSystemTools.h"
#endif
#include "cmStringAlgorithms.h"
+#include "cmSystemTools.h"
#if defined(_WIN32)
# include <vector>
@@ -110,6 +110,11 @@ std::string cmCurlFixFileURL(std::string url)
return url;
}
+ // libcurl 7.77 and below accidentally allowed spaces in URLs in some cases.
+ // One such case was file:// URLs, which CMake has long accepted as a result.
+ // Explicitly encode spaces for a URL.
+ cmSystemTools::ReplaceString(url, " ", "%20");
+
#if defined(_WIN32)
// libcurl doesn't support file:// urls for unicode filenames on Windows.
// Convert string from UTF-8 to ACP if this is a file:// URL.