diff options
author | bryner@chromium.org <bryner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-22 19:47:19 +0000 |
---|---|---|
committer | bryner@chromium.org <bryner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-22 19:47:19 +0000 |
commit | 6d81b488e8cc5e10eaeca0a4ee4819dc3f469a24 (patch) | |
tree | e628aa40ac26d26a6a9a46374001be983e7a7f41 /net/base/host_port_pair.cc | |
parent | f19572134235f4cceb76e85e1c064ba668bbd3bd (diff) | |
download | chromium_src-6d81b488e8cc5e10eaeca0a4ee4819dc3f469a24.zip chromium_src-6d81b488e8cc5e10eaeca0a4ee4819dc3f469a24.tar.gz chromium_src-6d81b488e8cc5e10eaeca0a4ee4819dc3f469a24.tar.bz2 |
Propagate the remote socket address to URLRequest and to ViewHostMsg_FrameNavigate.
This will be used to run pre-classification checks for client-side phishing
detection, and will also enable the socket address to be exposed via the
webRequest extension API. This is adapted from the original patch by pmarks
on http://codereview.chromium.org/6369003/ .
BUG=51663
TEST=added socket address checks to various unittests
Review URL: http://codereview.chromium.org/6488010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75620 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/host_port_pair.cc')
-rw-r--r-- | net/base/host_port_pair.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/net/base/host_port_pair.cc b/net/base/host_port_pair.cc index 1c4406f..5164fcf 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_); } |