| 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); |
|
Eric
2016/09/07 16:50:53
Canonicalization can add escape sequences, so sizi
Oleksandr
2016/09/08 02:51:15
Done.
|
| + DWORD urlSize = urlCanonicalized.length(); |
| + UrlCanonicalizeW(url.c_str(), &urlCanonicalized[0], &urlSize, 0); |
|
Eric
2016/09/07 16:50:53
You can call this function with argument 'dwFlags'
Eric
2016/09/07 16:50:53
Need to verify the return value here, just in case
Oleksandr
2016/09/08 02:51:15
Done.
Oleksandr
2016/09/08 02:51:15
Done.
|
| + urlCanonicalized.resize(urlSize); |
| + return urlCanonicalized; |
| +} |
| + |
| +std::wstring EscapeUrl(const std::wstring& url) |
|
Eric
2016/09/07 16:50:53
If we don't compare using escaped URL forms, we do
Oleksandr
2016/09/08 02:51:15
Done.
|
| +{ |
| + std::wstring urlEscaped; |
| + urlEscaped.resize(url.length() * 2); |
| + DWORD urlSize = urlEscaped.length(); |
| + UrlEscapeW(url.c_str(), &urlEscaped[0], &urlSize, 0); |
| + urlEscaped.resize(urlSize); |
| + return urlEscaped; |
| +} |
| + |