Index: src/shared/Utils.cpp |
=================================================================== |
--- a/src/shared/Utils.cpp |
+++ b/src/shared/Utils.cpp |
@@ -21,6 +21,7 @@ |
#include <Windows.h> |
#include <ShlObj.h> |
+#include <Shlwapi.h> |
#include "Utils.h" |
@@ -204,3 +205,24 @@ |
} |
return url.substr(queryStringBeginsAt, endQueryStringPos - queryStringBeginsAt); |
} |
+ |
+std::wstring CanonicalizeUrl(const std::wstring& url) |
+{ |
+ std::wstring urlCanonicalized; |
+ urlCanonicalized.resize(url.length() * 2); |
+ DWORD urlSize = urlCanonicalized.length(); |
+ UrlCanonicalizeW(url.c_str(), &urlCanonicalized[0], &urlSize, NULL); |
sergei
2016/09/07 08:23:31
What about using of 0 instead of NULL for dwFlags
Oleksandr
2016/09/07 09:13:43
Done.
|
+ urlCanonicalized.resize(urlSize); |
+ return urlCanonicalized; |
+} |
+ |
+std::wstring EscapeUrl(const std::wstring& url) |
+{ |
+ std::wstring urlEscaped; |
+ urlEscaped.resize(url.length() * 2); |
+ DWORD urlSize = urlEscaped.length(); |
+ UrlEscapeW(url.c_str(), &urlEscaped[0], &urlSize, NULL); |
+ urlEscaped.resize(urlSize); |
+ return urlEscaped; |
+} |
+ |