Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/time.h" | 9 #include "base/time/time.h" |
| 10 #include "net/base/auth.h" | 10 #include "net/base/auth.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 99 // This bit is set if ssl_info recorded that PKP was bypassed due to a local | 99 // This bit is set if ssl_info recorded that PKP was bypassed due to a local |
| 100 // trust anchor. | 100 // trust anchor. |
| 101 RESPONSE_INFO_PKP_BYPASSED = 1 << 23, | 101 RESPONSE_INFO_PKP_BYPASSED = 1 << 23, |
| 102 | 102 |
| 103 // TODO(darin): Add other bits to indicate alternate request methods. | 103 // TODO(darin): Add other bits to indicate alternate request methods. |
| 104 // For now, we don't support storing those. | 104 // For now, we don't support storing those. |
| 105 }; | 105 }; |
| 106 | 106 |
| 107 HttpResponseInfo::HttpResponseInfo() | 107 HttpResponseInfo::HttpResponseInfo() |
| 108 : was_cached(false), | 108 : was_cached(false), |
| 109 cache_info(CacheInfo::UNDEFINED), | |
| 109 server_data_unavailable(false), | 110 server_data_unavailable(false), |
| 110 network_accessed(false), | 111 network_accessed(false), |
| 111 was_fetched_via_spdy(false), | 112 was_fetched_via_spdy(false), |
| 112 was_npn_negotiated(false), | 113 was_npn_negotiated(false), |
| 113 was_fetched_via_proxy(false), | 114 was_fetched_via_proxy(false), |
| 114 did_use_http_auth(false), | 115 did_use_http_auth(false), |
| 115 unused_since_prefetch(false), | 116 unused_since_prefetch(false), |
| 116 async_revalidation_required(false), | 117 async_revalidation_required(false), |
| 117 connection_info(CONNECTION_INFO_UNKNOWN) {} | 118 connection_info(CONNECTION_INFO_UNKNOWN) {} |
| 118 | 119 |
| 119 HttpResponseInfo::HttpResponseInfo(const HttpResponseInfo& rhs) | 120 HttpResponseInfo::HttpResponseInfo(const HttpResponseInfo& rhs) |
| 120 : was_cached(rhs.was_cached), | 121 : was_cached(rhs.was_cached), |
| 122 cache_info(rhs.cache_info), | |
| 121 server_data_unavailable(rhs.server_data_unavailable), | 123 server_data_unavailable(rhs.server_data_unavailable), |
| 122 network_accessed(rhs.network_accessed), | 124 network_accessed(rhs.network_accessed), |
| 123 was_fetched_via_spdy(rhs.was_fetched_via_spdy), | 125 was_fetched_via_spdy(rhs.was_fetched_via_spdy), |
| 124 was_npn_negotiated(rhs.was_npn_negotiated), | 126 was_npn_negotiated(rhs.was_npn_negotiated), |
| 125 was_fetched_via_proxy(rhs.was_fetched_via_proxy), | 127 was_fetched_via_proxy(rhs.was_fetched_via_proxy), |
| 126 proxy_server(rhs.proxy_server), | 128 proxy_server(rhs.proxy_server), |
| 127 did_use_http_auth(rhs.did_use_http_auth), | 129 did_use_http_auth(rhs.did_use_http_auth), |
| 128 unused_since_prefetch(rhs.unused_since_prefetch), | 130 unused_since_prefetch(rhs.unused_since_prefetch), |
| 129 async_revalidation_required(rhs.async_revalidation_required), | 131 async_revalidation_required(rhs.async_revalidation_required), |
| 130 socket_address(rhs.socket_address), | 132 socket_address(rhs.socket_address), |
| 131 npn_negotiated_protocol(rhs.npn_negotiated_protocol), | 133 npn_negotiated_protocol(rhs.npn_negotiated_protocol), |
| 132 connection_info(rhs.connection_info), | 134 connection_info(rhs.connection_info), |
| 133 request_time(rhs.request_time), | 135 request_time(rhs.request_time), |
| 134 response_time(rhs.response_time), | 136 response_time(rhs.response_time), |
| 135 auth_challenge(rhs.auth_challenge), | 137 auth_challenge(rhs.auth_challenge), |
| 136 cert_request_info(rhs.cert_request_info), | 138 cert_request_info(rhs.cert_request_info), |
| 137 ssl_info(rhs.ssl_info), | 139 ssl_info(rhs.ssl_info), |
| 138 headers(rhs.headers), | 140 headers(rhs.headers), |
| 139 vary_data(rhs.vary_data), | 141 vary_data(rhs.vary_data), |
| 140 metadata(rhs.metadata) {} | 142 metadata(rhs.metadata) {} |
| 141 | 143 |
| 142 HttpResponseInfo::~HttpResponseInfo() { | 144 HttpResponseInfo::~HttpResponseInfo() { |
| 143 } | 145 } |
| 144 | 146 |
| 145 HttpResponseInfo& HttpResponseInfo::operator=(const HttpResponseInfo& rhs) { | 147 HttpResponseInfo& HttpResponseInfo::operator=(const HttpResponseInfo& rhs) { |
| 146 was_cached = rhs.was_cached; | 148 was_cached = rhs.was_cached; |
| 149 cache_info = rhs.cache_info; | |
| 147 server_data_unavailable = rhs.server_data_unavailable; | 150 server_data_unavailable = rhs.server_data_unavailable; |
| 148 network_accessed = rhs.network_accessed; | 151 network_accessed = rhs.network_accessed; |
| 149 was_fetched_via_spdy = rhs.was_fetched_via_spdy; | 152 was_fetched_via_spdy = rhs.was_fetched_via_spdy; |
| 150 proxy_server = rhs.proxy_server; | 153 proxy_server = rhs.proxy_server; |
| 151 was_npn_negotiated = rhs.was_npn_negotiated; | 154 was_npn_negotiated = rhs.was_npn_negotiated; |
| 152 was_fetched_via_proxy = rhs.was_fetched_via_proxy; | 155 was_fetched_via_proxy = rhs.was_fetched_via_proxy; |
| 153 did_use_http_auth = rhs.did_use_http_auth; | 156 did_use_http_auth = rhs.did_use_http_auth; |
| 154 unused_since_prefetch = rhs.unused_since_prefetch; | 157 unused_since_prefetch = rhs.unused_since_prefetch; |
| 155 async_revalidation_required = rhs.async_revalidation_required; | 158 async_revalidation_required = rhs.async_revalidation_required; |
| 156 socket_address = rhs.socket_address; | 159 socket_address = rhs.socket_address; |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 181 DLOG(ERROR) << "unexpected response info version: " << version; | 184 DLOG(ERROR) << "unexpected response info version: " << version; |
| 182 return false; | 185 return false; |
| 183 } | 186 } |
| 184 | 187 |
| 185 // Read request-time | 188 // Read request-time |
| 186 int64_t time_val; | 189 int64_t time_val; |
| 187 if (!iter.ReadInt64(&time_val)) | 190 if (!iter.ReadInt64(&time_val)) |
| 188 return false; | 191 return false; |
| 189 request_time = Time::FromInternalValue(time_val); | 192 request_time = Time::FromInternalValue(time_val); |
| 190 was_cached = true; // Set status to show cache resurrection. | 193 was_cached = true; // Set status to show cache resurrection. |
| 194 cache_info = CacheInfo::ENTRY_USED; | |
|
jkarlin
2016/06/30 19:01:12
It's too early to set ENTRY_USED here. HttpCacheTr
jamartin
2016/07/04 17:12:26
Done.
| |
| 191 | 195 |
| 192 // Read response-time | 196 // Read response-time |
| 193 if (!iter.ReadInt64(&time_val)) | 197 if (!iter.ReadInt64(&time_val)) |
| 194 return false; | 198 return false; |
| 195 response_time = Time::FromInternalValue(time_val); | 199 response_time = Time::FromInternalValue(time_val); |
| 196 | 200 |
| 197 // Read response-headers | 201 // Read response-headers |
| 198 headers = new HttpResponseHeaders(&iter); | 202 headers = new HttpResponseHeaders(&iter); |
| 199 if (headers->response_code() == -1) | 203 if (headers->response_code() == -1) |
| 200 return false; | 204 return false; |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 437 case CONNECTION_INFO_QUIC1_SPDY3: | 441 case CONNECTION_INFO_QUIC1_SPDY3: |
| 438 return "quic/1+spdy/3"; | 442 return "quic/1+spdy/3"; |
| 439 case NUM_OF_CONNECTION_INFOS: | 443 case NUM_OF_CONNECTION_INFOS: |
| 440 break; | 444 break; |
| 441 } | 445 } |
| 442 NOTREACHED(); | 446 NOTREACHED(); |
| 443 return ""; | 447 return ""; |
| 444 } | 448 } |
| 445 | 449 |
| 446 } // namespace net | 450 } // namespace net |
| OLD | NEW |