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/http/http_response_info.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/http/http_response_info.cc')
-rw-r--r-- | net/http/http_response_info.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/net/http/http_response_info.cc b/net/http/http_response_info.cc index 2c23faa..9b3444a 100644 --- a/net/http/http_response_info.cc +++ b/net/http/http_response_info.cc @@ -74,6 +74,7 @@ HttpResponseInfo::HttpResponseInfo(const HttpResponseInfo& rhs) was_npn_negotiated(rhs.was_npn_negotiated), was_alternate_protocol_available(rhs.was_alternate_protocol_available), was_fetched_via_proxy(rhs.was_fetched_via_proxy), + socket_address(rhs.socket_address), request_time(rhs.request_time), response_time(rhs.response_time), auth_challenge(rhs.auth_challenge), @@ -93,6 +94,7 @@ HttpResponseInfo& HttpResponseInfo::operator=(const HttpResponseInfo& rhs) { was_npn_negotiated = rhs.was_npn_negotiated; was_alternate_protocol_available = rhs.was_alternate_protocol_available; was_fetched_via_proxy = rhs.was_fetched_via_proxy; + socket_address = rhs.socket_address; request_time = rhs.request_time; response_time = rhs.response_time; auth_challenge = rhs.auth_challenge; @@ -158,6 +160,18 @@ bool HttpResponseInfo::InitFromPickle(const Pickle& pickle, return false; } + // Read socket_address. This was not always present in the response info, + // so we don't fail if it can't be read. If additional fields are added in + // a future version, then they must only be read if this operation succeeds. + std::string socket_address_host; + if (pickle.ReadString(&iter, &socket_address_host)) { + // If the host was written, we always expect the port to follow. + uint16 socket_address_port; + if (!pickle.ReadUInt16(&iter, &socket_address_port)) + return false; + socket_address = HostPortPair(socket_address_host, socket_address_port); + } + was_fetched_via_spdy = (flags & RESPONSE_INFO_WAS_SPDY) != 0; was_npn_negotiated = (flags & RESPONSE_INFO_WAS_NPN) != 0; @@ -223,6 +237,9 @@ void HttpResponseInfo::Persist(Pickle* pickle, if (vary_data.is_valid()) vary_data.Persist(pickle); + + pickle->WriteString(socket_address.host()); + pickle->WriteUInt16(socket_address.port()); } } // namespace net |