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

Unified Diff: url/gurl.cc

Issue 2956643002: Add GURL::HostNoBracketsPiece() (Closed)
Patch Set: Simplify test Created 3 years, 6 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 | « url/gurl.h ('k') | url/gurl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: url/gurl.cc
diff --git a/url/gurl.cc b/url/gurl.cc
index 1fe48db378ef65188606ab665baa719075db8a46..128652fe37be5c14e6e253927ecef169084505da 100644
--- a/url/gurl.cc
+++ b/url/gurl.cc
@@ -452,13 +452,17 @@ std::string GURL::PathForRequest() const {
}
std::string GURL::HostNoBrackets() const {
+ return HostNoBracketsPiece().as_string();
+}
+
+base::StringPiece GURL::HostNoBracketsPiece() const {
// If host looks like an IPv6 literal, strip the square brackets.
url::Component h(parsed_.host);
if (h.len >= 2 && spec_[h.begin] == '[' && spec_[h.end() - 1] == ']') {
h.begin++;
h.len -= 2;
}
- return ComponentString(h);
+ return ComponentStringPiece(h);
}
std::string GURL::GetContent() const {
« no previous file with comments | « url/gurl.h ('k') | url/gurl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698