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

Side by Side Diff: url/gurl.h

Issue 185133005: Move referrer stripping into GURL::GetAsReferrer(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Restore the behavior of setting the referrer when it's invalid in URLRequest::SetReferrer. Created 6 years, 9 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 | « net/url_request/url_request.cc ('k') | url/gurl.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 URL_GURL_H_ 5 #ifndef URL_GURL_H_
6 #define URL_GURL_H_ 6 #define URL_GURL_H_
7 7
8 #include <iosfwd> 8 #include <iosfwd>
9 #include <string> 9 #include <string>
10 10
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 // and port from a URL. Equivalent to clearing any username and password, 188 // and port from a URL. Equivalent to clearing any username and password,
189 // replacing the path with a slash, and clearing everything after that. If 189 // replacing the path with a slash, and clearing everything after that. If
190 // this URL is not a standard URL, then the result will be an empty, 190 // this URL is not a standard URL, then the result will be an empty,
191 // invalid GURL. If the URL has neither username nor password, this 191 // invalid GURL. If the URL has neither username nor password, this
192 // degenerates to GetWithEmptyPath(). 192 // degenerates to GetWithEmptyPath().
193 // 193 //
194 // It is an error to get the origin of an invalid URL. The result 194 // It is an error to get the origin of an invalid URL. The result
195 // will be the empty URL. 195 // will be the empty URL.
196 GURL GetOrigin() const; 196 GURL GetOrigin() const;
197 197
198 // A helper function to return a GURL stripped from the elements that are not
199 // supposed to be sent as HTTP referrer: username, password and ref fragment.
200 // For invalid URLs the original URL will be returned.
201 GURL GetAsReferrer() const;
202
198 // Returns true if the scheme for the current URL is a known "standard" 203 // Returns true if the scheme for the current URL is a known "standard"
199 // scheme. Standard schemes have an authority and a path section. This 204 // scheme. Standard schemes have an authority and a path section. This
200 // includes file: and filesystem:, which some callers may want to filter out 205 // includes file: and filesystem:, which some callers may want to filter out
201 // explicitly by calling SchemeIsFile[System]. 206 // explicitly by calling SchemeIsFile[System].
202 bool IsStandard() const; 207 bool IsStandard() const;
203 208
204 // Returns true if the given parameter (should be lower-case ASCII to match 209 // Returns true if the given parameter (should be lower-case ASCII to match
205 // the canonicalized scheme) is the scheme for this URL. This call is more 210 // the canonicalized scheme) is the scheme for this URL. This call is more
206 // efficient than getting the scheme and comparing it because no copies or 211 // efficient than getting the scheme and comparing it because no copies or
207 // object constructions are done. 212 // object constructions are done.
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 // Used for nested schemes [currently only filesystem:]. 397 // Used for nested schemes [currently only filesystem:].
393 scoped_ptr<GURL> inner_url_; 398 scoped_ptr<GURL> inner_url_;
394 399
395 // TODO bug 684583: Add encoding for query params. 400 // TODO bug 684583: Add encoding for query params.
396 }; 401 };
397 402
398 // Stream operator so GURL can be used in assertion statements. 403 // Stream operator so GURL can be used in assertion statements.
399 URL_EXPORT std::ostream& operator<<(std::ostream& out, const GURL& url); 404 URL_EXPORT std::ostream& operator<<(std::ostream& out, const GURL& url);
400 405
401 #endif // URL_GURL_H_ 406 #endif // URL_GURL_H_
OLDNEW
« no previous file with comments | « net/url_request/url_request.cc ('k') | url/gurl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698