Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Unified Diff: net/base/url_util.h

Issue 632843003: Add a function to escape a query part of url (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename the function to EscapeQueryParameters Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/base/url_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/url_util.h
diff --git a/net/base/url_util.h b/net/base/url_util.h
index 362be873c11cd4b01936280c7b097e724b432fb5..ed4ee7d7c97b48342699d1edcf00c7ce047a7bb2 100644
--- a/net/base/url_util.h
+++ b/net/base/url_util.h
@@ -77,6 +77,17 @@ NET_EXPORT bool GetValueForKeyInQuery(const GURL& url,
const std::string& search_key,
std::string* out_value);
+// Returns a new GURL which is same to |url| except that unsafe characters in a
+// name and a value of each of query parameters are escaped like %XX%XX.
Ryan Sleevi 2014/10/09 21:11:04 Grammatically, this is not valid. "Returns a new
+//
+// Examples:
+//
+// EscapeQueryParameters(GURL("http://example.com/test?q=a|b|c")).spec()
+// => "http://example.com/test?q=a%7Cb%7Cc"
+// EscapeQueryParameters(GURL("http://example.com/test?q=a|b&q2=1|2")).spec()
+// => "http://example.com/test?q=a%7Cb&q2=1%7C2"
+NET_EXPORT GURL EscapeQueryParameters(const GURL& url);
+
} // namespace net
#endif // NET_BASE_URL_UTIL_H_
« no previous file with comments | « no previous file | net/base/url_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698