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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 response_time = rhs.response_time; | 152 response_time = rhs.response_time; |
153 auth_challenge = rhs.auth_challenge; | 153 auth_challenge = rhs.auth_challenge; |
154 cert_request_info = rhs.cert_request_info; | 154 cert_request_info = rhs.cert_request_info; |
155 ssl_info = rhs.ssl_info; | 155 ssl_info = rhs.ssl_info; |
156 headers = rhs.headers; | 156 headers = rhs.headers; |
157 vary_data = rhs.vary_data; | 157 vary_data = rhs.vary_data; |
158 metadata = rhs.metadata; | 158 metadata = rhs.metadata; |
159 return *this; | 159 return *this; |
160 } | 160 } |
161 | 161 |
162 bool HttpResponseInfo::InitFromPickle(const Pickle& pickle, | 162 bool HttpResponseInfo::InitFromPickle(const base::Pickle& pickle, |
163 bool* response_truncated) { | 163 bool* response_truncated) { |
164 PickleIterator iter(pickle); | 164 base::PickleIterator iter(pickle); |
165 | 165 |
166 // Read flags and verify version | 166 // Read flags and verify version |
167 int flags; | 167 int flags; |
168 if (!iter.ReadInt(&flags)) | 168 if (!iter.ReadInt(&flags)) |
169 return false; | 169 return false; |
170 int version = flags & RESPONSE_INFO_VERSION_MASK; | 170 int version = flags & RESPONSE_INFO_VERSION_MASK; |
171 if (version < RESPONSE_INFO_MINIMUM_VERSION || | 171 if (version < RESPONSE_INFO_MINIMUM_VERSION || |
172 version > RESPONSE_INFO_VERSION) { | 172 version > RESPONSE_INFO_VERSION) { |
173 DLOG(ERROR) << "unexpected response info version: " << version; | 173 DLOG(ERROR) << "unexpected response info version: " << version; |
174 return false; | 174 return false; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 | 280 |
281 *response_truncated = (flags & RESPONSE_INFO_TRUNCATED) != 0; | 281 *response_truncated = (flags & RESPONSE_INFO_TRUNCATED) != 0; |
282 | 282 |
283 did_use_http_auth = (flags & RESPONSE_INFO_USE_HTTP_AUTHENTICATION) != 0; | 283 did_use_http_auth = (flags & RESPONSE_INFO_USE_HTTP_AUTHENTICATION) != 0; |
284 | 284 |
285 unused_since_prefetch = (flags & RESPONSE_INFO_UNUSED_SINCE_PREFETCH) != 0; | 285 unused_since_prefetch = (flags & RESPONSE_INFO_UNUSED_SINCE_PREFETCH) != 0; |
286 | 286 |
287 return true; | 287 return true; |
288 } | 288 } |
289 | 289 |
290 void HttpResponseInfo::Persist(Pickle* pickle, | 290 void HttpResponseInfo::Persist(base::Pickle* pickle, |
291 bool skip_transient_headers, | 291 bool skip_transient_headers, |
292 bool response_truncated) const { | 292 bool response_truncated) const { |
293 int flags = RESPONSE_INFO_VERSION; | 293 int flags = RESPONSE_INFO_VERSION; |
294 if (ssl_info.is_valid()) { | 294 if (ssl_info.is_valid()) { |
295 flags |= RESPONSE_INFO_HAS_CERT; | 295 flags |= RESPONSE_INFO_HAS_CERT; |
296 flags |= RESPONSE_INFO_HAS_CERT_STATUS; | 296 flags |= RESPONSE_INFO_HAS_CERT_STATUS; |
297 if (ssl_info.security_bits != -1) | 297 if (ssl_info.security_bits != -1) |
298 flags |= RESPONSE_INFO_HAS_SECURITY_BITS; | 298 flags |= RESPONSE_INFO_HAS_SECURITY_BITS; |
299 if (ssl_info.connection_status != 0) | 299 if (ssl_info.connection_status != 0) |
300 flags |= RESPONSE_INFO_HAS_SSL_CONNECTION_STATUS; | 300 flags |= RESPONSE_INFO_HAS_SSL_CONNECTION_STATUS; |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 case CONNECTION_INFO_QUIC1_SPDY3: | 419 case CONNECTION_INFO_QUIC1_SPDY3: |
420 return "quic/1+spdy/3"; | 420 return "quic/1+spdy/3"; |
421 case NUM_OF_CONNECTION_INFOS: | 421 case NUM_OF_CONNECTION_INFOS: |
422 break; | 422 break; |
423 } | 423 } |
424 NOTREACHED(); | 424 NOTREACHED(); |
425 return ""; | 425 return ""; |
426 } | 426 } |
427 | 427 |
428 } // namespace net | 428 } // namespace net |
OLD | NEW |