Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/http/http_response_info.h" | 5 #include "net/http/http_response_info.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/pickle.h" | 8 #include "base/pickle.h" |
| 9 #include "base/time.h" | 9 #include "base/time.h" |
| 10 #include "net/base/auth.h" | 10 #include "net/base/auth.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 67 was_alternate_protocol_available(false), | 67 was_alternate_protocol_available(false), |
| 68 was_fetched_via_proxy(false) { | 68 was_fetched_via_proxy(false) { |
| 69 } | 69 } |
| 70 | 70 |
| 71 HttpResponseInfo::HttpResponseInfo(const HttpResponseInfo& rhs) | 71 HttpResponseInfo::HttpResponseInfo(const HttpResponseInfo& rhs) |
| 72 : was_cached(rhs.was_cached), | 72 : was_cached(rhs.was_cached), |
| 73 was_fetched_via_spdy(rhs.was_fetched_via_spdy), | 73 was_fetched_via_spdy(rhs.was_fetched_via_spdy), |
| 74 was_npn_negotiated(rhs.was_npn_negotiated), | 74 was_npn_negotiated(rhs.was_npn_negotiated), |
| 75 was_alternate_protocol_available(rhs.was_alternate_protocol_available), | 75 was_alternate_protocol_available(rhs.was_alternate_protocol_available), |
| 76 was_fetched_via_proxy(rhs.was_fetched_via_proxy), | 76 was_fetched_via_proxy(rhs.was_fetched_via_proxy), |
| 77 socket_address(rhs.socket_address), | |
| 77 request_time(rhs.request_time), | 78 request_time(rhs.request_time), |
| 78 response_time(rhs.response_time), | 79 response_time(rhs.response_time), |
| 79 auth_challenge(rhs.auth_challenge), | 80 auth_challenge(rhs.auth_challenge), |
| 80 cert_request_info(rhs.cert_request_info), | 81 cert_request_info(rhs.cert_request_info), |
| 81 ssl_info(rhs.ssl_info), | 82 ssl_info(rhs.ssl_info), |
| 82 headers(rhs.headers), | 83 headers(rhs.headers), |
| 83 vary_data(rhs.vary_data), | 84 vary_data(rhs.vary_data), |
| 84 metadata(rhs.metadata) { | 85 metadata(rhs.metadata) { |
| 85 } | 86 } |
| 86 | 87 |
| 87 HttpResponseInfo::~HttpResponseInfo() { | 88 HttpResponseInfo::~HttpResponseInfo() { |
| 88 } | 89 } |
| 89 | 90 |
| 90 HttpResponseInfo& HttpResponseInfo::operator=(const HttpResponseInfo& rhs) { | 91 HttpResponseInfo& HttpResponseInfo::operator=(const HttpResponseInfo& rhs) { |
| 91 was_cached = rhs.was_cached; | 92 was_cached = rhs.was_cached; |
| 92 was_fetched_via_spdy = rhs.was_fetched_via_spdy; | 93 was_fetched_via_spdy = rhs.was_fetched_via_spdy; |
| 93 was_npn_negotiated = rhs.was_npn_negotiated; | 94 was_npn_negotiated = rhs.was_npn_negotiated; |
| 94 was_alternate_protocol_available = rhs.was_alternate_protocol_available; | 95 was_alternate_protocol_available = rhs.was_alternate_protocol_available; |
| 95 was_fetched_via_proxy = rhs.was_fetched_via_proxy; | 96 was_fetched_via_proxy = rhs.was_fetched_via_proxy; |
| 97 socket_address = rhs.socket_address; | |
| 96 request_time = rhs.request_time; | 98 request_time = rhs.request_time; |
| 97 response_time = rhs.response_time; | 99 response_time = rhs.response_time; |
| 98 auth_challenge = rhs.auth_challenge; | 100 auth_challenge = rhs.auth_challenge; |
| 99 cert_request_info = rhs.cert_request_info; | 101 cert_request_info = rhs.cert_request_info; |
| 100 ssl_info = rhs.ssl_info; | 102 ssl_info = rhs.ssl_info; |
| 101 headers = rhs.headers; | 103 headers = rhs.headers; |
| 102 vary_data = rhs.vary_data; | 104 vary_data = rhs.vary_data; |
| 103 metadata = rhs.metadata; | 105 metadata = rhs.metadata; |
| 104 return *this; | 106 return *this; |
| 105 } | 107 } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 151 return false; | 153 return false; |
| 152 ssl_info.security_bits = security_bits; | 154 ssl_info.security_bits = security_bits; |
| 153 } | 155 } |
| 154 | 156 |
| 155 // read vary-data | 157 // read vary-data |
| 156 if (flags & RESPONSE_INFO_HAS_VARY_DATA) { | 158 if (flags & RESPONSE_INFO_HAS_VARY_DATA) { |
| 157 if (!vary_data.InitFromPickle(pickle, &iter)) | 159 if (!vary_data.InitFromPickle(pickle, &iter)) |
| 158 return false; | 160 return false; |
| 159 } | 161 } |
| 160 | 162 |
| 163 // Read socket_address. This was not always present in the response info, | |
| 164 // so we don't fail if it can't be read. | |
|
pmarks
2011/02/11 00:36:39
I would add "If additional fields are added in a f
Brian Ryner
2011/02/11 23:01:07
Done.
| |
| 165 pickle.ReadString(&iter, &socket_address); | |
| 166 | |
| 161 was_fetched_via_spdy = (flags & RESPONSE_INFO_WAS_SPDY) != 0; | 167 was_fetched_via_spdy = (flags & RESPONSE_INFO_WAS_SPDY) != 0; |
| 162 | 168 |
| 163 was_npn_negotiated = (flags & RESPONSE_INFO_WAS_NPN) != 0; | 169 was_npn_negotiated = (flags & RESPONSE_INFO_WAS_NPN) != 0; |
| 164 | 170 |
| 165 was_alternate_protocol_available = | 171 was_alternate_protocol_available = |
| 166 (flags & RESPONSE_INFO_WAS_ALTERNATE_PROTOCOL_AVAILABLE) != 0; | 172 (flags & RESPONSE_INFO_WAS_ALTERNATE_PROTOCOL_AVAILABLE) != 0; |
| 167 | 173 |
| 168 was_fetched_via_proxy = (flags & RESPONSE_INFO_WAS_PROXY) != 0; | 174 was_fetched_via_proxy = (flags & RESPONSE_INFO_WAS_PROXY) != 0; |
| 169 | 175 |
| 170 *response_truncated = (flags & RESPONSE_INFO_TRUNCATED) ? true : false; | 176 *response_truncated = (flags & RESPONSE_INFO_TRUNCATED) ? true : false; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 216 | 222 |
| 217 if (ssl_info.is_valid()) { | 223 if (ssl_info.is_valid()) { |
| 218 ssl_info.cert->Persist(pickle); | 224 ssl_info.cert->Persist(pickle); |
| 219 pickle->WriteInt(ssl_info.cert_status); | 225 pickle->WriteInt(ssl_info.cert_status); |
| 220 if (ssl_info.security_bits != -1) | 226 if (ssl_info.security_bits != -1) |
| 221 pickle->WriteInt(ssl_info.security_bits); | 227 pickle->WriteInt(ssl_info.security_bits); |
| 222 } | 228 } |
| 223 | 229 |
| 224 if (vary_data.is_valid()) | 230 if (vary_data.is_valid()) |
| 225 vary_data.Persist(pickle); | 231 vary_data.Persist(pickle); |
| 232 | |
| 233 pickle->WriteString(socket_address); | |
| 226 } | 234 } |
| 227 | 235 |
| 228 } // namespace net | 236 } // namespace net |
| OLD | NEW |