Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: src/shared/Utils.cpp

Issue 5921969115496448: Issue 1115 - Some yahoo page not correctly shown on IE8 when ABP enabled (Closed)
Patch Set: simplify processing of query string Created Feb. 16, 2015, 10:48 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/shared/Utils.h ('k') | test/UtilGetQueryStringTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/shared/Utils.cpp
diff --git a/src/shared/Utils.cpp b/src/shared/Utils.cpp
index 52b5a69f7920a6b9a49a46e16b250e2accaa33f8..5314709a6aa49d69b4ceb3ce2f24b4078f42accf 100644
--- a/src/shared/Utils.cpp
+++ b/src/shared/Utils.cpp
@@ -147,3 +147,29 @@ void ReplaceString(std::wstring& input, const std::wstring placeholder, const st
input.replace(replaceStart, placeholder.length(), replacement);
}
}
+
+std::wstring GetSchemeAndHierarchicalPart(const std::wstring& url)
+{
+ auto schemeAndHierarchicalPartEndsAt = url.find(L'?');
+ if (schemeAndHierarchicalPartEndsAt == std::wstring::npos)
+ {
+ schemeAndHierarchicalPartEndsAt = url.find(L'#');
+ }
+ return url.substr(0, schemeAndHierarchicalPartEndsAt);
+}
+
+std::wstring GetQueryString(const std::wstring& url)
+{
+ auto questionSignPos = url.find(L'?');
+ if (questionSignPos == std::wstring::npos)
+ {
+ return L"";
+ }
+ auto queryStringBeginsAt = questionSignPos + 1;
+ auto endQueryStringPos = url.find(L'#', queryStringBeginsAt);
+ if (endQueryStringPos == std::wstring::npos)
+ {
+ endQueryStringPos = url.length();
+ }
+ return url.substr(queryStringBeginsAt, endQueryStringPos - queryStringBeginsAt);
+}
« no previous file with comments | « src/shared/Utils.h ('k') | test/UtilGetQueryStringTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld