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

Unified Diff: src/gurl.h

Issue 113187: GURL: add a HostNoBrackets() method for bracketless IPv6 literals. (Closed) Base URL: http://google-url.googlecode.com/svn/trunk/
Patch Set: '' Created 11 years, 7 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 | src/gurl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gurl.h
===================================================================
--- src/gurl.h (revision 101)
+++ src/gurl.h (working copy)
@@ -242,6 +242,9 @@
std::string password() const {
return ComponentString(parsed_.password);
}
+ // Note that this may be a hostname, an IPv4 address, or an IPv6 literal
+ // surrounded by square brackets, like "[2001:db8::1]". To exclude these
+ // brackets, use HostNoBrackets() below.
std::string host() const {
return ComponentString(parsed_.host);
}
@@ -307,6 +310,10 @@
// parameter, and query portions of the URL. It is guaranteed to be ASCII.
std::string PathForRequest() const;
+ // Returns the host, excluding the square brackets surrounding IPv6 address
+ // literals. This can be useful for passing to getaddrinfo().
+ std::string HostNoBrackets() const;
+
// Returns true if this URL's host matches or is in the same domain as
// the given input string. For example if this URL was "www.google.com",
// this would match "com", "google.com", and "www.google.com
« no previous file with comments | « no previous file | src/gurl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698