Chromium Code Reviews| Index: net/http/http_response_info.cc |
| diff --git a/net/http/http_response_info.cc b/net/http/http_response_info.cc |
| index 2c23faac4e1bb7e21ad81fa9cbd38e12f5b2beec..9b3444ad68c550a145edba4133365a6b49bc62ab 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); |
| + } |
|
wtc
2011/04/21 22:44:25
We should have bumped the version number when we s
Brian Ryner
2011/04/22 00:44:27
Hm, wouldn't that have caused all existing respons
wtc
2011/04/22 19:07:13
We could change the check on line 118 to allow ver
|
| + |
| 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 |