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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | net/base/url_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NET_BASE_URL_UTIL_H_ 5 #ifndef NET_BASE_URL_UTIL_H_
6 #define NET_BASE_URL_UTIL_H_ 6 #define NET_BASE_URL_UTIL_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 DISALLOW_COPY_AND_ASSIGN(QueryIterator); 70 DISALLOW_COPY_AND_ASSIGN(QueryIterator);
71 }; 71 };
72 72
73 // Looks for |search_key| in the query portion of |url|. Returns true if the 73 // Looks for |search_key| in the query portion of |url|. Returns true if the
74 // key is found and sets |out_value| to the unescaped value for the key. 74 // key is found and sets |out_value| to the unescaped value for the key.
75 // Returns false if the key is not found. 75 // Returns false if the key is not found.
76 NET_EXPORT bool GetValueForKeyInQuery(const GURL& url, 76 NET_EXPORT bool GetValueForKeyInQuery(const GURL& url,
77 const std::string& search_key, 77 const std::string& search_key,
78 std::string* out_value); 78 std::string* out_value);
79 79
80 // Returns a new GURL which is same to |url| except that unsafe characters in a
81 // 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
82 //
83 // Examples:
84 //
85 // EscapeQueryParameters(GURL("http://example.com/test?q=a|b|c")).spec()
86 // => "http://example.com/test?q=a%7Cb%7Cc"
87 // EscapeQueryParameters(GURL("http://example.com/test?q=a|b&q2=1|2")).spec()
88 // => "http://example.com/test?q=a%7Cb&q2=1%7C2"
89 NET_EXPORT GURL EscapeQueryParameters(const GURL& url);
90
80 } // namespace net 91 } // namespace net
81 92
82 #endif // NET_BASE_URL_UTIL_H_ 93 #endif // NET_BASE_URL_UTIL_H_
OLDNEW
« 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