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

Unified Diff: net/base/host_port_pair.cc

Issue 6488010: Propagate the remote socket address to URLRequest and to ViewHostMsg_FrameNavigate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address eroman's comments Created 9 years, 10 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
Index: net/base/host_port_pair.cc
diff --git a/net/base/host_port_pair.cc b/net/base/host_port_pair.cc
index 1c4406f4b7fb3952f4cac0beff25cb910bba36e5..5164fcf0c2b910408d247555e599434c7b48a42d 100644
--- a/net/base/host_port_pair.cc
+++ b/net/base/host_port_pair.cc
@@ -7,6 +7,8 @@
#include "base/string_util.h"
#include "base/stringprintf.h"
#include "googleurl/src/gurl.h"
+#include "net/base/net_util.h"
+#include "net/base/sys_addrinfo.h"
namespace net {
@@ -19,6 +21,12 @@ HostPortPair HostPortPair::FromURL(const GURL& url) {
return HostPortPair(url.HostNoBrackets(), url.EffectiveIntPort());
}
+// static
+HostPortPair HostPortPair::FromAddrInfo(const struct addrinfo* ai) {
+ return HostPortPair(NetAddressToString(ai),
+ GetPortFromSockaddr(ai->ai_addr, ai->ai_addrlen));
+}
+
std::string HostPortPair::ToString() const {
return base::StringPrintf("%s:%u", HostForURL().c_str(), port_);
}

Powered by Google App Engine
This is Rietveld 408576698